2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
4 #include "org_ldk_impl_bindings.h"
10 #define LIKELY(v) __builtin_expect(!!(v), 1)
11 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
13 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
14 #define MALLOC(a, _) malloc(a)
15 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
16 #define CHECK_ACCESS(p)
17 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
18 #define DO_ASSERT(a) (void)(a)
21 static jmethodID ordinal_meth = NULL;
22 static jmethodID slicedef_meth = NULL;
23 static jclass slicedef_cls = NULL;
24 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
25 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
26 CHECK(ordinal_meth != NULL);
27 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
28 CHECK(slicedef_meth != NULL);
29 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
30 CHECK(slicedef_cls != NULL);
33 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
36 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
39 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
42 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
43 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
44 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
47 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
48 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
49 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
50 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
53 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
54 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
55 vec->datalen = (*env)->GetArrayLength(env, bytes);
56 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
57 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
60 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
61 LDKTransaction *txdata = (LDKTransaction*)ptr;
63 slice.data = txdata->data;
64 slice.datalen = txdata->datalen;
65 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
67 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
68 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
69 txdata->datalen = (*env)->GetArrayLength(env, bytes);
70 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
71 txdata->data_is_owned = false;
72 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
73 return (uint64_t)txdata;
75 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
76 LDKTransaction *tx = (LDKTransaction*)ptr;
77 tx->data_is_owned = true;
78 Transaction_free(*tx);
81 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
82 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
83 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
84 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
85 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
86 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
87 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
88 return (uint64_t)vec->datalen;
90 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
91 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
92 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
93 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
94 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
95 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
96 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
102 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
103 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
104 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
105 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
107 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
108 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
109 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
111 typedef jlongArray int64_tArray;
112 typedef jbyteArray int8_tArray;
114 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
115 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
116 char* conv_buf = MALLOC(len + 1, "str conv buf");
117 memcpy(conv_buf, chars, len);
119 jstring ret = (*env)->NewStringUTF(env, conv_buf);
123 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
124 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
125 char* newchars = MALLOC(str_len + 1, "String chars");
126 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
127 memcpy(newchars, jchars, str_len);
128 newchars[str_len] = 0;
129 (*env)->ReleaseStringUTFChars(env, str, jchars);
133 .chars_is_owned = true
138 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
139 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
141 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
142 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
145 static jclass arr_of_B_clz = NULL;
146 static jclass arr_of_J_clz = NULL;
147 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
148 arr_of_B_clz = (*env)->FindClass(env, "[B");
149 CHECK(arr_of_B_clz != NULL);
150 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
151 arr_of_J_clz = (*env)->FindClass(env, "[J");
152 CHECK(arr_of_J_clz != NULL);
153 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
155 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
156 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
157 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
158 if (UNLIKELY((*env)->ExceptionCheck(env))) {
159 (*env)->ExceptionDescribe(env);
160 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception.");
163 case 0: return LDKAccessError_UnknownChain;
164 case 1: return LDKAccessError_UnknownTx;
166 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value.");
167 abort(); // Unreachable, but will let the compiler know we don't return here
169 static jclass AccessError_class = NULL;
170 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
171 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
172 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
173 AccessError_class = (*env)->NewGlobalRef(env, clz);
174 CHECK(AccessError_class != NULL);
175 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
176 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
177 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
178 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
180 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
182 case LDKAccessError_UnknownChain:
183 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
184 case LDKAccessError_UnknownTx:
185 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
190 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
191 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
192 if (UNLIKELY((*env)->ExceptionCheck(env))) {
193 (*env)->ExceptionDescribe(env);
194 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
197 case 0: return LDKCOption_NoneZ_Some;
198 case 1: return LDKCOption_NoneZ_None;
200 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
201 abort(); // Unreachable, but will let the compiler know we don't return here
203 static jclass COption_NoneZ_class = NULL;
204 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
205 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
206 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
207 COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
208 CHECK(COption_NoneZ_class != NULL);
209 COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
210 CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
211 COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
212 CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
214 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
216 case LDKCOption_NoneZ_Some:
217 return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
218 case LDKCOption_NoneZ_None:
219 return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
224 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
225 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
226 if (UNLIKELY((*env)->ExceptionCheck(env))) {
227 (*env)->ExceptionDescribe(env);
228 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust threw an exception.");
231 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
232 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
234 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust returned an invalid value.");
235 abort(); // Unreachable, but will let the compiler know we don't return here
237 static jclass ChannelMonitorUpdateErr_class = NULL;
238 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
239 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
240 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
241 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
242 CHECK(ChannelMonitorUpdateErr_class != NULL);
243 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
244 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
245 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
246 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
248 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
250 case LDKChannelMonitorUpdateErr_TemporaryFailure:
251 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
252 case LDKChannelMonitorUpdateErr_PermanentFailure:
253 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
258 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
259 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
260 if (UNLIKELY((*env)->ExceptionCheck(env))) {
261 (*env)->ExceptionDescribe(env);
262 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
265 case 0: return LDKConfirmationTarget_Background;
266 case 1: return LDKConfirmationTarget_Normal;
267 case 2: return LDKConfirmationTarget_HighPriority;
269 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
270 abort(); // Unreachable, but will let the compiler know we don't return here
272 static jclass ConfirmationTarget_class = NULL;
273 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
274 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
275 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
276 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
277 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
278 CHECK(ConfirmationTarget_class != NULL);
279 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
280 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
281 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
282 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
283 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
284 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
286 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
288 case LDKConfirmationTarget_Background:
289 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
290 case LDKConfirmationTarget_Normal:
291 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
292 case LDKConfirmationTarget_HighPriority:
293 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
298 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
299 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
300 if (UNLIKELY((*env)->ExceptionCheck(env))) {
301 (*env)->ExceptionDescribe(env);
302 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
305 case 0: return LDKCreationError_DescriptionTooLong;
306 case 1: return LDKCreationError_RouteTooLong;
307 case 2: return LDKCreationError_TimestampOutOfBounds;
308 case 3: return LDKCreationError_InvalidAmount;
309 case 4: return LDKCreationError_MissingRouteHints;
311 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
312 abort(); // Unreachable, but will let the compiler know we don't return here
314 static jclass CreationError_class = NULL;
315 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
316 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
317 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
318 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
319 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
320 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
321 CreationError_class = (*env)->NewGlobalRef(env, clz);
322 CHECK(CreationError_class != NULL);
323 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
324 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
325 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
326 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
327 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
328 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
329 CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
330 CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
331 CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
332 CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
334 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
336 case LDKCreationError_DescriptionTooLong:
337 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
338 case LDKCreationError_RouteTooLong:
339 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
340 case LDKCreationError_TimestampOutOfBounds:
341 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
342 case LDKCreationError_InvalidAmount:
343 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
344 case LDKCreationError_MissingRouteHints:
345 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
350 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
351 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
352 if (UNLIKELY((*env)->ExceptionCheck(env))) {
353 (*env)->ExceptionDescribe(env);
354 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
357 case 0: return LDKCurrency_Bitcoin;
358 case 1: return LDKCurrency_BitcoinTestnet;
359 case 2: return LDKCurrency_Regtest;
360 case 3: return LDKCurrency_Simnet;
361 case 4: return LDKCurrency_Signet;
363 (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
364 abort(); // Unreachable, but will let the compiler know we don't return here
366 static jclass Currency_class = NULL;
367 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
368 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
369 static jfieldID Currency_LDKCurrency_Regtest = NULL;
370 static jfieldID Currency_LDKCurrency_Simnet = NULL;
371 static jfieldID Currency_LDKCurrency_Signet = NULL;
372 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
373 Currency_class = (*env)->NewGlobalRef(env, clz);
374 CHECK(Currency_class != NULL);
375 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
376 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
377 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
378 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
379 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
380 CHECK(Currency_LDKCurrency_Regtest != NULL);
381 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
382 CHECK(Currency_LDKCurrency_Simnet != NULL);
383 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
384 CHECK(Currency_LDKCurrency_Signet != NULL);
386 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
388 case LDKCurrency_Bitcoin:
389 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
390 case LDKCurrency_BitcoinTestnet:
391 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
392 case LDKCurrency_Regtest:
393 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
394 case LDKCurrency_Simnet:
395 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
396 case LDKCurrency_Signet:
397 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
402 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
403 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
404 if (UNLIKELY((*env)->ExceptionCheck(env))) {
405 (*env)->ExceptionDescribe(env);
406 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
409 case 0: return LDKIOError_NotFound;
410 case 1: return LDKIOError_PermissionDenied;
411 case 2: return LDKIOError_ConnectionRefused;
412 case 3: return LDKIOError_ConnectionReset;
413 case 4: return LDKIOError_ConnectionAborted;
414 case 5: return LDKIOError_NotConnected;
415 case 6: return LDKIOError_AddrInUse;
416 case 7: return LDKIOError_AddrNotAvailable;
417 case 8: return LDKIOError_BrokenPipe;
418 case 9: return LDKIOError_AlreadyExists;
419 case 10: return LDKIOError_WouldBlock;
420 case 11: return LDKIOError_InvalidInput;
421 case 12: return LDKIOError_InvalidData;
422 case 13: return LDKIOError_TimedOut;
423 case 14: return LDKIOError_WriteZero;
424 case 15: return LDKIOError_Interrupted;
425 case 16: return LDKIOError_Other;
426 case 17: return LDKIOError_UnexpectedEof;
428 (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
429 abort(); // Unreachable, but will let the compiler know we don't return here
431 static jclass IOError_class = NULL;
432 static jfieldID IOError_LDKIOError_NotFound = NULL;
433 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
434 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
435 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
436 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
437 static jfieldID IOError_LDKIOError_NotConnected = NULL;
438 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
439 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
440 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
441 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
442 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
443 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
444 static jfieldID IOError_LDKIOError_InvalidData = NULL;
445 static jfieldID IOError_LDKIOError_TimedOut = NULL;
446 static jfieldID IOError_LDKIOError_WriteZero = NULL;
447 static jfieldID IOError_LDKIOError_Interrupted = NULL;
448 static jfieldID IOError_LDKIOError_Other = NULL;
449 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
450 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
451 IOError_class = (*env)->NewGlobalRef(env, clz);
452 CHECK(IOError_class != NULL);
453 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
454 CHECK(IOError_LDKIOError_NotFound != NULL);
455 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
456 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
457 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
458 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
459 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
460 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
461 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
462 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
463 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
464 CHECK(IOError_LDKIOError_NotConnected != NULL);
465 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
466 CHECK(IOError_LDKIOError_AddrInUse != NULL);
467 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
468 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
469 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
470 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
471 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
472 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
473 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
474 CHECK(IOError_LDKIOError_WouldBlock != NULL);
475 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
476 CHECK(IOError_LDKIOError_InvalidInput != NULL);
477 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
478 CHECK(IOError_LDKIOError_InvalidData != NULL);
479 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
480 CHECK(IOError_LDKIOError_TimedOut != NULL);
481 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
482 CHECK(IOError_LDKIOError_WriteZero != NULL);
483 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
484 CHECK(IOError_LDKIOError_Interrupted != NULL);
485 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
486 CHECK(IOError_LDKIOError_Other != NULL);
487 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
488 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
490 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
492 case LDKIOError_NotFound:
493 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
494 case LDKIOError_PermissionDenied:
495 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
496 case LDKIOError_ConnectionRefused:
497 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
498 case LDKIOError_ConnectionReset:
499 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
500 case LDKIOError_ConnectionAborted:
501 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
502 case LDKIOError_NotConnected:
503 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
504 case LDKIOError_AddrInUse:
505 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
506 case LDKIOError_AddrNotAvailable:
507 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
508 case LDKIOError_BrokenPipe:
509 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
510 case LDKIOError_AlreadyExists:
511 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
512 case LDKIOError_WouldBlock:
513 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
514 case LDKIOError_InvalidInput:
515 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
516 case LDKIOError_InvalidData:
517 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
518 case LDKIOError_TimedOut:
519 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
520 case LDKIOError_WriteZero:
521 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
522 case LDKIOError_Interrupted:
523 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
524 case LDKIOError_Other:
525 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
526 case LDKIOError_UnexpectedEof:
527 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
532 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
533 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
534 if (UNLIKELY((*env)->ExceptionCheck(env))) {
535 (*env)->ExceptionDescribe(env);
536 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
539 case 0: return LDKLevel_Gossip;
540 case 1: return LDKLevel_Trace;
541 case 2: return LDKLevel_Debug;
542 case 3: return LDKLevel_Info;
543 case 4: return LDKLevel_Warn;
544 case 5: return LDKLevel_Error;
546 (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
547 abort(); // Unreachable, but will let the compiler know we don't return here
549 static jclass Level_class = NULL;
550 static jfieldID Level_LDKLevel_Gossip = NULL;
551 static jfieldID Level_LDKLevel_Trace = NULL;
552 static jfieldID Level_LDKLevel_Debug = NULL;
553 static jfieldID Level_LDKLevel_Info = NULL;
554 static jfieldID Level_LDKLevel_Warn = NULL;
555 static jfieldID Level_LDKLevel_Error = NULL;
556 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
557 Level_class = (*env)->NewGlobalRef(env, clz);
558 CHECK(Level_class != NULL);
559 Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
560 CHECK(Level_LDKLevel_Gossip != NULL);
561 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
562 CHECK(Level_LDKLevel_Trace != NULL);
563 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
564 CHECK(Level_LDKLevel_Debug != NULL);
565 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
566 CHECK(Level_LDKLevel_Info != NULL);
567 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
568 CHECK(Level_LDKLevel_Warn != NULL);
569 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
570 CHECK(Level_LDKLevel_Error != NULL);
572 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
574 case LDKLevel_Gossip:
575 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
577 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
579 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
581 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
583 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
585 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
590 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
591 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
592 if (UNLIKELY((*env)->ExceptionCheck(env))) {
593 (*env)->ExceptionDescribe(env);
594 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
597 case 0: return LDKNetwork_Bitcoin;
598 case 1: return LDKNetwork_Testnet;
599 case 2: return LDKNetwork_Regtest;
600 case 3: return LDKNetwork_Signet;
602 (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
603 abort(); // Unreachable, but will let the compiler know we don't return here
605 static jclass Network_class = NULL;
606 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
607 static jfieldID Network_LDKNetwork_Testnet = NULL;
608 static jfieldID Network_LDKNetwork_Regtest = NULL;
609 static jfieldID Network_LDKNetwork_Signet = NULL;
610 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
611 Network_class = (*env)->NewGlobalRef(env, clz);
612 CHECK(Network_class != NULL);
613 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
614 CHECK(Network_LDKNetwork_Bitcoin != NULL);
615 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
616 CHECK(Network_LDKNetwork_Testnet != NULL);
617 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
618 CHECK(Network_LDKNetwork_Regtest != NULL);
619 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
620 CHECK(Network_LDKNetwork_Signet != NULL);
622 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
624 case LDKNetwork_Bitcoin:
625 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
626 case LDKNetwork_Testnet:
627 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
628 case LDKNetwork_Regtest:
629 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
630 case LDKNetwork_Signet:
631 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
636 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
637 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
638 if (UNLIKELY((*env)->ExceptionCheck(env))) {
639 (*env)->ExceptionDescribe(env);
640 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
643 case 0: return LDKRecipient_Node;
644 case 1: return LDKRecipient_PhantomNode;
646 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
647 abort(); // Unreachable, but will let the compiler know we don't return here
649 static jclass Recipient_class = NULL;
650 static jfieldID Recipient_LDKRecipient_Node = NULL;
651 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
652 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
653 Recipient_class = (*env)->NewGlobalRef(env, clz);
654 CHECK(Recipient_class != NULL);
655 Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
656 CHECK(Recipient_LDKRecipient_Node != NULL);
657 Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
658 CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
660 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
662 case LDKRecipient_Node:
663 return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
664 case LDKRecipient_PhantomNode:
665 return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
670 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
671 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
672 if (UNLIKELY((*env)->ExceptionCheck(env))) {
673 (*env)->ExceptionDescribe(env);
674 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
677 case 0: return LDKSecp256k1Error_IncorrectSignature;
678 case 1: return LDKSecp256k1Error_InvalidMessage;
679 case 2: return LDKSecp256k1Error_InvalidPublicKey;
680 case 3: return LDKSecp256k1Error_InvalidSignature;
681 case 4: return LDKSecp256k1Error_InvalidSecretKey;
682 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
683 case 6: return LDKSecp256k1Error_InvalidTweak;
684 case 7: return LDKSecp256k1Error_TweakCheckFailed;
685 case 8: return LDKSecp256k1Error_NotEnoughMemory;
687 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
688 abort(); // Unreachable, but will let the compiler know we don't return here
690 static jclass Secp256k1Error_class = NULL;
691 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
692 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
693 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
694 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
695 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
696 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
697 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
698 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
699 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
700 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
701 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
702 CHECK(Secp256k1Error_class != NULL);
703 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
704 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
705 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
706 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
707 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
708 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
709 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
710 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
711 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
712 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
713 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
714 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
715 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
716 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
717 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
718 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
719 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
720 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
722 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
724 case LDKSecp256k1Error_IncorrectSignature:
725 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
726 case LDKSecp256k1Error_InvalidMessage:
727 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
728 case LDKSecp256k1Error_InvalidPublicKey:
729 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
730 case LDKSecp256k1Error_InvalidSignature:
731 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
732 case LDKSecp256k1Error_InvalidSecretKey:
733 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
734 case LDKSecp256k1Error_InvalidRecoveryId:
735 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
736 case LDKSecp256k1Error_InvalidTweak:
737 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
738 case LDKSecp256k1Error_TweakCheckFailed:
739 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
740 case LDKSecp256k1Error_NotEnoughMemory:
741 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
746 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
747 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
748 if (UNLIKELY((*env)->ExceptionCheck(env))) {
749 (*env)->ExceptionDescribe(env);
750 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception.");
753 case 0: return LDKSemanticError_NoPaymentHash;
754 case 1: return LDKSemanticError_MultiplePaymentHashes;
755 case 2: return LDKSemanticError_NoDescription;
756 case 3: return LDKSemanticError_MultipleDescriptions;
757 case 4: return LDKSemanticError_NoPaymentSecret;
758 case 5: return LDKSemanticError_MultiplePaymentSecrets;
759 case 6: return LDKSemanticError_InvalidFeatures;
760 case 7: return LDKSemanticError_InvalidRecoveryId;
761 case 8: return LDKSemanticError_InvalidSignature;
762 case 9: return LDKSemanticError_ImpreciseAmount;
764 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value.");
765 abort(); // Unreachable, but will let the compiler know we don't return here
767 static jclass SemanticError_class = NULL;
768 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
769 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
770 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
771 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
772 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
773 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
774 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
775 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
776 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
777 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
778 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
779 SemanticError_class = (*env)->NewGlobalRef(env, clz);
780 CHECK(SemanticError_class != NULL);
781 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
782 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
783 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
784 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
785 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
786 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
787 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
788 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
789 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
790 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
791 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
792 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
793 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
794 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
795 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
796 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
797 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
798 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
799 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
800 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
802 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
804 case LDKSemanticError_NoPaymentHash:
805 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
806 case LDKSemanticError_MultiplePaymentHashes:
807 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
808 case LDKSemanticError_NoDescription:
809 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
810 case LDKSemanticError_MultipleDescriptions:
811 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
812 case LDKSemanticError_NoPaymentSecret:
813 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
814 case LDKSemanticError_MultiplePaymentSecrets:
815 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
816 case LDKSemanticError_InvalidFeatures:
817 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
818 case LDKSemanticError_InvalidRecoveryId:
819 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
820 case LDKSemanticError_InvalidSignature:
821 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
822 case LDKSemanticError_ImpreciseAmount:
823 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
828 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
829 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
830 if (UNLIKELY((*env)->ExceptionCheck(env))) {
831 (*env)->ExceptionDescribe(env);
832 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
835 case 0: return LDKSiPrefix_Milli;
836 case 1: return LDKSiPrefix_Micro;
837 case 2: return LDKSiPrefix_Nano;
838 case 3: return LDKSiPrefix_Pico;
840 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
841 abort(); // Unreachable, but will let the compiler know we don't return here
843 static jclass SiPrefix_class = NULL;
844 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
845 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
846 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
847 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
848 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
849 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
850 CHECK(SiPrefix_class != NULL);
851 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
852 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
853 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
854 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
855 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
856 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
857 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
858 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
860 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
862 case LDKSiPrefix_Milli:
863 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
864 case LDKSiPrefix_Micro:
865 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
866 case LDKSiPrefix_Nano:
867 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
868 case LDKSiPrefix_Pico:
869 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
874 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
875 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
876 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
879 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) {
880 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
881 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
882 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
883 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
884 CVec_u8Z_free(ret_var);
888 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) {
889 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
890 int64_t ret_val = TxOut_get_value(thing_conv);
894 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
895 CHECK(owner->result_ok);
896 return *owner->contents.result;
898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
899 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
900 CResult_NoneNoneZ_get_ok(owner_conv);
903 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
904 CHECK(!owner->result_ok);
905 return *owner->contents.err;
907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
908 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
909 CResult_NoneNoneZ_get_err(owner_conv);
912 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
913 CHECK(owner->result_ok);
914 return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
917 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
918 LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
919 uintptr_t ret_ref = 0;
920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
923 ret_ref = (uintptr_t)ret_var.inner;
924 if (ret_var.is_owned) {
930 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
931 CHECK(!owner->result_ok);
932 return DecodeError_clone(&*owner->contents.err);
934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
935 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
936 LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
937 uintptr_t ret_ref = 0;
938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
941 ret_ref = (uintptr_t)ret_var.inner;
942 if (ret_var.is_owned) {
948 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
949 CHECK(owner->result_ok);
950 return *owner->contents.result;
952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
953 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
954 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
955 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
959 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
960 CHECK(!owner->result_ok);
961 return *owner->contents.err;
963 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
964 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
965 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
969 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
970 CHECK(owner->result_ok);
971 return *owner->contents.result;
973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
974 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
975 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
976 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
980 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
981 CHECK(!owner->result_ok);
982 return *owner->contents.err;
984 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
985 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
986 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
990 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
991 CHECK(owner->result_ok);
992 return TxCreationKeys_clone(&*owner->contents.result);
994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
995 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
996 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
997 uintptr_t ret_ref = 0;
998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1001 ret_ref = (uintptr_t)ret_var.inner;
1002 if (ret_var.is_owned) {
1008 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1009 CHECK(!owner->result_ok);
1010 return DecodeError_clone(&*owner->contents.err);
1012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1013 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
1014 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1015 uintptr_t ret_ref = 0;
1016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1019 ret_ref = (uintptr_t)ret_var.inner;
1020 if (ret_var.is_owned) {
1026 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1027 CHECK(owner->result_ok);
1028 return ChannelPublicKeys_clone(&*owner->contents.result);
1030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1031 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1032 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1033 uintptr_t ret_ref = 0;
1034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1037 ret_ref = (uintptr_t)ret_var.inner;
1038 if (ret_var.is_owned) {
1044 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1045 CHECK(!owner->result_ok);
1046 return DecodeError_clone(&*owner->contents.err);
1048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1049 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1050 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1051 uintptr_t ret_ref = 0;
1052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1055 ret_ref = (uintptr_t)ret_var.inner;
1056 if (ret_var.is_owned) {
1062 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1063 CHECK(owner->result_ok);
1064 return TxCreationKeys_clone(&*owner->contents.result);
1066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1067 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1068 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
1069 uintptr_t ret_ref = 0;
1070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1073 ret_ref = (uintptr_t)ret_var.inner;
1074 if (ret_var.is_owned) {
1080 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1081 CHECK(!owner->result_ok);
1082 return *owner->contents.err;
1084 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1085 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1086 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1090 static jclass LDKCOption_u32Z_Some_class = NULL;
1091 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1092 static jclass LDKCOption_u32Z_None_class = NULL;
1093 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1095 LDKCOption_u32Z_Some_class =
1096 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1097 CHECK(LDKCOption_u32Z_Some_class != NULL);
1098 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1099 CHECK(LDKCOption_u32Z_Some_meth != NULL);
1100 LDKCOption_u32Z_None_class =
1101 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1102 CHECK(LDKCOption_u32Z_None_class != NULL);
1103 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1104 CHECK(LDKCOption_u32Z_None_meth != NULL);
1106 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1107 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
1109 case LDKCOption_u32Z_Some: {
1110 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
1112 case LDKCOption_u32Z_None: {
1113 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1118 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1119 CHECK(owner->result_ok);
1120 return HTLCOutputInCommitment_clone(&*owner->contents.result);
1122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1123 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1124 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1125 uintptr_t ret_ref = 0;
1126 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1127 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1129 ret_ref = (uintptr_t)ret_var.inner;
1130 if (ret_var.is_owned) {
1136 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1137 CHECK(!owner->result_ok);
1138 return DecodeError_clone(&*owner->contents.err);
1140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1141 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1142 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1143 uintptr_t ret_ref = 0;
1144 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1145 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1147 ret_ref = (uintptr_t)ret_var.inner;
1148 if (ret_var.is_owned) {
1154 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1155 CHECK(owner->result_ok);
1156 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
1158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1159 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1160 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1161 uintptr_t ret_ref = 0;
1162 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1163 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1165 ret_ref = (uintptr_t)ret_var.inner;
1166 if (ret_var.is_owned) {
1172 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1173 CHECK(!owner->result_ok);
1174 return DecodeError_clone(&*owner->contents.err);
1176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1177 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1178 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1179 uintptr_t ret_ref = 0;
1180 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1181 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1182 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1183 ret_ref = (uintptr_t)ret_var.inner;
1184 if (ret_var.is_owned) {
1190 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1191 CHECK(owner->result_ok);
1192 return ChannelTransactionParameters_clone(&*owner->contents.result);
1194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1195 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1196 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1197 uintptr_t ret_ref = 0;
1198 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1199 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1201 ret_ref = (uintptr_t)ret_var.inner;
1202 if (ret_var.is_owned) {
1208 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1209 CHECK(!owner->result_ok);
1210 return DecodeError_clone(&*owner->contents.err);
1212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1213 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1214 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1215 uintptr_t ret_ref = 0;
1216 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1217 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1219 ret_ref = (uintptr_t)ret_var.inner;
1220 if (ret_var.is_owned) {
1226 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1227 CHECK(owner->result_ok);
1228 return HolderCommitmentTransaction_clone(&*owner->contents.result);
1230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1231 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1232 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1233 uintptr_t ret_ref = 0;
1234 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1235 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1236 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1237 ret_ref = (uintptr_t)ret_var.inner;
1238 if (ret_var.is_owned) {
1244 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1245 CHECK(!owner->result_ok);
1246 return DecodeError_clone(&*owner->contents.err);
1248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1249 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1250 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1251 uintptr_t ret_ref = 0;
1252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1255 ret_ref = (uintptr_t)ret_var.inner;
1256 if (ret_var.is_owned) {
1262 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1263 CHECK(owner->result_ok);
1264 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
1266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1267 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1268 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1269 uintptr_t ret_ref = 0;
1270 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1271 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1273 ret_ref = (uintptr_t)ret_var.inner;
1274 if (ret_var.is_owned) {
1280 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1281 CHECK(!owner->result_ok);
1282 return DecodeError_clone(&*owner->contents.err);
1284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1285 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1286 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1287 uintptr_t ret_ref = 0;
1288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1291 ret_ref = (uintptr_t)ret_var.inner;
1292 if (ret_var.is_owned) {
1298 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1299 CHECK(owner->result_ok);
1300 return &*owner->contents.result;
1302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1303 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1304 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1305 uintptr_t ret_ref = 0;
1306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1309 ret_ref = (uintptr_t)ret_var.inner & ~1;
1313 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1314 CHECK(!owner->result_ok);
1315 return *owner->contents.err;
1317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1318 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1319 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1322 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1323 CHECK(owner->result_ok);
1324 return CommitmentTransaction_clone(&*owner->contents.result);
1326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1327 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1328 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1329 uintptr_t ret_ref = 0;
1330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1333 ret_ref = (uintptr_t)ret_var.inner;
1334 if (ret_var.is_owned) {
1340 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1341 CHECK(!owner->result_ok);
1342 return DecodeError_clone(&*owner->contents.err);
1344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1345 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1346 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1347 uintptr_t ret_ref = 0;
1348 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1349 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1350 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1351 ret_ref = (uintptr_t)ret_var.inner;
1352 if (ret_var.is_owned) {
1358 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1359 CHECK(owner->result_ok);
1360 return &*owner->contents.result;
1362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1363 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1364 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1365 uintptr_t ret_ref = 0;
1366 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1367 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1369 ret_ref = (uintptr_t)ret_var.inner & ~1;
1373 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1374 CHECK(!owner->result_ok);
1375 return *owner->contents.err;
1377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1378 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1379 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1382 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1383 CHECK(owner->result_ok);
1384 return *owner->contents.result;
1386 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1387 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1388 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1389 jobjectArray ret_arr = NULL;
1390 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1392 for (size_t i = 0; i < ret_var.datalen; i++) {
1393 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1394 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1395 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1401 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1402 CHECK(!owner->result_ok);
1403 return *owner->contents.err;
1405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1406 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1407 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1410 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1411 CHECK(owner->result_ok);
1412 return ShutdownScript_clone(&*owner->contents.result);
1414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1415 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1416 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1417 uintptr_t ret_ref = 0;
1418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1421 ret_ref = (uintptr_t)ret_var.inner;
1422 if (ret_var.is_owned) {
1428 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1429 CHECK(!owner->result_ok);
1430 return DecodeError_clone(&*owner->contents.err);
1432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1433 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1434 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1435 uintptr_t ret_ref = 0;
1436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1439 ret_ref = (uintptr_t)ret_var.inner;
1440 if (ret_var.is_owned) {
1446 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1447 CHECK(owner->result_ok);
1448 return ShutdownScript_clone(&*owner->contents.result);
1450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1451 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1452 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1453 uintptr_t ret_ref = 0;
1454 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1455 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1457 ret_ref = (uintptr_t)ret_var.inner;
1458 if (ret_var.is_owned) {
1464 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1465 CHECK(!owner->result_ok);
1466 return InvalidShutdownScript_clone(&*owner->contents.err);
1468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1469 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1470 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1471 uintptr_t ret_ref = 0;
1472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1475 ret_ref = (uintptr_t)ret_var.inner;
1476 if (ret_var.is_owned) {
1482 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1483 CHECK(owner->result_ok);
1484 return *owner->contents.result;
1486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1487 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1488 CResult_NoneErrorZ_get_ok(owner_conv);
1491 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1492 CHECK(!owner->result_ok);
1493 return *owner->contents.err;
1495 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1496 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1497 jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
1501 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1502 CHECK(owner->result_ok);
1503 return RouteHop_clone(&*owner->contents.result);
1505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1506 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1507 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_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_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *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_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1524 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1525 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_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_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1538 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1539 for (size_t i = 0; i < ret.datalen; i++) {
1540 ret.data[i] = RouteHop_clone(&orig->data[i]);
1544 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1545 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1546 for (size_t i = 0; i < ret.datalen; i++) {
1547 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1551 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1552 CHECK(owner->result_ok);
1553 return Route_clone(&*owner->contents.result);
1555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1556 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1557 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1558 uintptr_t ret_ref = 0;
1559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1562 ret_ref = (uintptr_t)ret_var.inner;
1563 if (ret_var.is_owned) {
1569 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1570 CHECK(!owner->result_ok);
1571 return DecodeError_clone(&*owner->contents.err);
1573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1574 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1575 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1576 uintptr_t ret_ref = 0;
1577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1580 ret_ref = (uintptr_t)ret_var.inner;
1581 if (ret_var.is_owned) {
1587 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1588 CHECK(owner->result_ok);
1589 return RouteParameters_clone(&*owner->contents.result);
1591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1592 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1593 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1594 uintptr_t ret_ref = 0;
1595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1598 ret_ref = (uintptr_t)ret_var.inner;
1599 if (ret_var.is_owned) {
1605 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1606 CHECK(!owner->result_ok);
1607 return DecodeError_clone(&*owner->contents.err);
1609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1610 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1611 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1612 uintptr_t ret_ref = 0;
1613 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1614 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1616 ret_ref = (uintptr_t)ret_var.inner;
1617 if (ret_var.is_owned) {
1623 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1624 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1625 for (size_t i = 0; i < ret.datalen; i++) {
1626 ret.data[i] = RouteHint_clone(&orig->data[i]);
1630 static jclass LDKCOption_u64Z_Some_class = NULL;
1631 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1632 static jclass LDKCOption_u64Z_None_class = NULL;
1633 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1635 LDKCOption_u64Z_Some_class =
1636 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1637 CHECK(LDKCOption_u64Z_Some_class != NULL);
1638 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1639 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1640 LDKCOption_u64Z_None_class =
1641 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1642 CHECK(LDKCOption_u64Z_None_class != NULL);
1643 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1644 CHECK(LDKCOption_u64Z_None_meth != NULL);
1646 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1647 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1649 case LDKCOption_u64Z_Some: {
1650 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1652 case LDKCOption_u64Z_None: {
1653 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1658 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1659 CHECK(owner->result_ok);
1660 return PaymentParameters_clone(&*owner->contents.result);
1662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1663 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1664 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1665 uintptr_t ret_ref = 0;
1666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1669 ret_ref = (uintptr_t)ret_var.inner;
1670 if (ret_var.is_owned) {
1676 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1677 CHECK(!owner->result_ok);
1678 return DecodeError_clone(&*owner->contents.err);
1680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1681 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1682 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1683 uintptr_t ret_ref = 0;
1684 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1685 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1686 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1687 ret_ref = (uintptr_t)ret_var.inner;
1688 if (ret_var.is_owned) {
1694 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1695 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1696 for (size_t i = 0; i < ret.datalen; i++) {
1697 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1701 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1702 CHECK(owner->result_ok);
1703 return RouteHint_clone(&*owner->contents.result);
1705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1706 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1707 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1708 uintptr_t ret_ref = 0;
1709 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1710 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1712 ret_ref = (uintptr_t)ret_var.inner;
1713 if (ret_var.is_owned) {
1719 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1720 CHECK(!owner->result_ok);
1721 return DecodeError_clone(&*owner->contents.err);
1723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1724 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1725 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1726 uintptr_t ret_ref = 0;
1727 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1728 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1729 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1730 ret_ref = (uintptr_t)ret_var.inner;
1731 if (ret_var.is_owned) {
1737 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1738 CHECK(owner->result_ok);
1739 return RouteHintHop_clone(&*owner->contents.result);
1741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1742 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1743 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1744 uintptr_t ret_ref = 0;
1745 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1746 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1747 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1748 ret_ref = (uintptr_t)ret_var.inner;
1749 if (ret_var.is_owned) {
1755 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1756 CHECK(!owner->result_ok);
1757 return DecodeError_clone(&*owner->contents.err);
1759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1760 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1761 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1762 uintptr_t ret_ref = 0;
1763 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1764 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1765 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1766 ret_ref = (uintptr_t)ret_var.inner;
1767 if (ret_var.is_owned) {
1773 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1774 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1775 for (size_t i = 0; i < ret.datalen; i++) {
1776 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1780 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1781 CHECK(owner->result_ok);
1782 return Route_clone(&*owner->contents.result);
1784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1785 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1786 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1787 uintptr_t ret_ref = 0;
1788 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1789 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1791 ret_ref = (uintptr_t)ret_var.inner;
1792 if (ret_var.is_owned) {
1798 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1799 CHECK(!owner->result_ok);
1800 return LightningError_clone(&*owner->contents.err);
1802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1803 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1804 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1805 uintptr_t ret_ref = 0;
1806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1809 ret_ref = (uintptr_t)ret_var.inner;
1810 if (ret_var.is_owned) {
1816 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1817 CHECK(owner->result_ok);
1818 return TxOut_clone(&*owner->contents.result);
1820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1821 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1822 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1823 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
1824 return (uintptr_t)ret_ref;
1827 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1828 CHECK(!owner->result_ok);
1829 return AccessError_clone(&*owner->contents.err);
1831 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1832 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1833 jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
1837 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1840 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
1841 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1842 intptr_t ret_val = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1846 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
1850 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1851 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1852 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1853 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1857 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1858 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1859 for (size_t i = 0; i < ret.datalen; i++) {
1860 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1864 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
1865 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1866 for (size_t i = 0; i < ret.datalen; i++) {
1867 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1871 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1872 CHECK(owner->result_ok);
1873 return *owner->contents.result;
1875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1876 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1877 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
1880 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1881 CHECK(!owner->result_ok);
1882 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
1884 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1885 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1886 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
1890 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1891 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1892 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1893 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1894 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
1895 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
1896 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
1897 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
1898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1899 LDKMonitorEvent_HTLCEvent_class =
1900 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
1901 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1902 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1903 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1904 LDKMonitorEvent_CommitmentTxConfirmed_class =
1905 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
1906 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1907 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1908 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1909 LDKMonitorEvent_UpdateCompleted_class =
1910 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
1911 CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
1912 LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
1913 CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
1914 LDKMonitorEvent_UpdateFailed_class =
1915 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
1916 CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
1917 LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
1918 CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
1920 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1921 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1923 case LDKMonitorEvent_HTLCEvent: {
1924 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1925 uintptr_t htlc_event_ref = 0;
1926 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1927 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1928 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1929 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
1930 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1932 case LDKMonitorEvent_CommitmentTxConfirmed: {
1933 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1934 uintptr_t commitment_tx_confirmed_ref = 0;
1935 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1936 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1937 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1938 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
1939 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
1941 case LDKMonitorEvent_UpdateCompleted: {
1942 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1943 uintptr_t funding_txo_ref = 0;
1944 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1945 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1946 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1947 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
1948 return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, obj->update_completed.monitor_update_id);
1950 case LDKMonitorEvent_UpdateFailed: {
1951 LDKOutPoint update_failed_var = obj->update_failed;
1952 uintptr_t update_failed_ref = 0;
1953 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1954 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1955 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1956 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
1957 return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
1962 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1963 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1964 for (size_t i = 0; i < ret.datalen; i++) {
1965 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1969 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1970 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1971 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1972 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1974 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1975 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
1976 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1977 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1978 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1979 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1980 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
1981 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1982 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1983 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1985 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1986 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1988 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1989 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1990 *some_conv = obj->some;
1991 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1992 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((uintptr_t)some_conv));
1994 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1995 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
2000 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
2001 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
2002 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
2003 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
2004 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
2005 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
2006 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
2007 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
2008 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
2009 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
2010 static jclass LDKClosureReason_ProcessingError_class = NULL;
2011 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
2012 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
2013 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
2014 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
2015 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
2016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
2017 LDKClosureReason_CounterpartyForceClosed_class =
2018 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
2019 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
2020 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
2021 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
2022 LDKClosureReason_HolderForceClosed_class =
2023 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
2024 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
2025 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
2026 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
2027 LDKClosureReason_CooperativeClosure_class =
2028 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
2029 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
2030 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
2031 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
2032 LDKClosureReason_CommitmentTxConfirmed_class =
2033 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
2034 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
2035 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
2036 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
2037 LDKClosureReason_FundingTimedOut_class =
2038 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
2039 CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
2040 LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
2041 CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
2042 LDKClosureReason_ProcessingError_class =
2043 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
2044 CHECK(LDKClosureReason_ProcessingError_class != NULL);
2045 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
2046 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
2047 LDKClosureReason_DisconnectedPeer_class =
2048 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
2049 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
2050 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
2051 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
2052 LDKClosureReason_OutdatedChannelManager_class =
2053 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
2054 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
2055 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
2056 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
2058 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2059 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
2061 case LDKClosureReason_CounterpartyForceClosed: {
2062 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
2063 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
2064 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
2066 case LDKClosureReason_HolderForceClosed: {
2067 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
2069 case LDKClosureReason_CooperativeClosure: {
2070 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
2072 case LDKClosureReason_CommitmentTxConfirmed: {
2073 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
2075 case LDKClosureReason_FundingTimedOut: {
2076 return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
2078 case LDKClosureReason_ProcessingError: {
2079 LDKStr err_str = obj->processing_error.err;
2080 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2081 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
2083 case LDKClosureReason_DisconnectedPeer: {
2084 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
2086 case LDKClosureReason_OutdatedChannelManager: {
2087 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
2092 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
2093 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
2094 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
2095 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
2096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
2097 LDKCOption_ClosureReasonZ_Some_class =
2098 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
2099 CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
2100 LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
2101 CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
2102 LDKCOption_ClosureReasonZ_None_class =
2103 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
2104 CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
2105 LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
2106 CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
2108 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2109 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
2111 case LDKCOption_ClosureReasonZ_Some: {
2112 uintptr_t some_ref = ((uintptr_t)&obj->some) | 1;
2113 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
2115 case LDKCOption_ClosureReasonZ_None: {
2116 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
2121 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2122 CHECK(owner->result_ok);
2123 return COption_ClosureReasonZ_clone(&*owner->contents.result);
2125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2126 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2127 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2128 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2129 uintptr_t ret_ref = (uintptr_t)ret_copy;
2133 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2134 CHECK(!owner->result_ok);
2135 return DecodeError_clone(&*owner->contents.err);
2137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2138 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2139 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2140 uintptr_t ret_ref = 0;
2141 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2142 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2144 ret_ref = (uintptr_t)ret_var.inner;
2145 if (ret_var.is_owned) {
2151 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2152 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2153 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
2154 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
2155 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2156 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2158 LDKNetworkUpdate_ChannelUpdateMessage_class =
2159 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2160 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2161 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2162 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2163 LDKNetworkUpdate_ChannelClosed_class =
2164 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed"));
2165 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
2166 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
2167 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
2168 LDKNetworkUpdate_NodeFailure_class =
2169 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2170 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2171 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2172 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2174 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2175 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
2177 case LDKNetworkUpdate_ChannelUpdateMessage: {
2178 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2179 uintptr_t msg_ref = 0;
2180 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2181 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2182 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2183 msg_ref = (uintptr_t)msg_var.inner & ~1;
2184 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2186 case LDKNetworkUpdate_ChannelClosed: {
2187 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
2189 case LDKNetworkUpdate_NodeFailure: {
2190 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2191 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2192 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
2197 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2198 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2199 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2200 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2202 LDKCOption_NetworkUpdateZ_Some_class =
2203 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2204 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2205 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2206 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2207 LDKCOption_NetworkUpdateZ_None_class =
2208 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2209 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2210 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2211 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2213 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2214 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
2216 case LDKCOption_NetworkUpdateZ_Some: {
2217 uintptr_t some_ref = ((uintptr_t)&obj->some) | 1;
2218 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2220 case LDKCOption_NetworkUpdateZ_None: {
2221 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2226 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2227 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2228 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2229 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2230 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2231 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2233 LDKSpendableOutputDescriptor_StaticOutput_class =
2234 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2235 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2236 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2237 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2238 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2239 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2240 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2241 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2242 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2243 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2244 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2245 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2246 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2247 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2249 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2250 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
2252 case LDKSpendableOutputDescriptor_StaticOutput: {
2253 LDKOutPoint outpoint_var = obj->static_output.outpoint;
2254 uintptr_t outpoint_ref = 0;
2255 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2256 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2257 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2258 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
2259 uintptr_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
2260 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uintptr_t)output_ref);
2262 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2263 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2264 uintptr_t delayed_payment_output_ref = 0;
2265 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2266 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2267 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2268 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
2269 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2271 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2272 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2273 uintptr_t static_payment_output_ref = 0;
2274 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2275 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2276 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2277 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
2278 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2283 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2284 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2285 for (size_t i = 0; i < ret.datalen; i++) {
2286 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2290 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
2291 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
2292 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
2293 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
2294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
2295 LDKPaymentPurpose_InvoicePayment_class =
2296 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
2297 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
2298 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
2299 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
2300 LDKPaymentPurpose_SpontaneousPayment_class =
2301 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
2302 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
2303 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
2304 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
2306 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2307 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
2309 case LDKPaymentPurpose_InvoicePayment: {
2310 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2311 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
2312 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
2313 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
2314 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
2316 case LDKPaymentPurpose_SpontaneousPayment: {
2317 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
2318 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
2319 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
2324 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2325 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2326 static jclass LDKEvent_PaymentReceived_class = NULL;
2327 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2328 static jclass LDKEvent_PaymentSent_class = NULL;
2329 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2330 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2331 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2332 static jclass LDKEvent_PaymentFailed_class = NULL;
2333 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2334 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2335 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2336 static jclass LDKEvent_SpendableOutputs_class = NULL;
2337 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2338 static jclass LDKEvent_PaymentForwarded_class = NULL;
2339 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2340 static jclass LDKEvent_ChannelClosed_class = NULL;
2341 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2342 static jclass LDKEvent_DiscardFunding_class = NULL;
2343 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2344 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2345 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2346 static jclass LDKEvent_OpenChannelRequest_class = NULL;
2347 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
2348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2349 LDKEvent_FundingGenerationReady_class =
2350 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2351 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2352 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
2353 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2354 LDKEvent_PaymentReceived_class =
2355 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2356 CHECK(LDKEvent_PaymentReceived_class != NULL);
2357 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2358 CHECK(LDKEvent_PaymentReceived_meth != NULL);
2359 LDKEvent_PaymentSent_class =
2360 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2361 CHECK(LDKEvent_PaymentSent_class != NULL);
2362 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2363 CHECK(LDKEvent_PaymentSent_meth != NULL);
2364 LDKEvent_PaymentPathFailed_class =
2365 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2366 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2367 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2368 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2369 LDKEvent_PaymentFailed_class =
2370 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2371 CHECK(LDKEvent_PaymentFailed_class != NULL);
2372 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2373 CHECK(LDKEvent_PaymentFailed_meth != NULL);
2374 LDKEvent_PendingHTLCsForwardable_class =
2375 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2376 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2377 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2378 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2379 LDKEvent_SpendableOutputs_class =
2380 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2381 CHECK(LDKEvent_SpendableOutputs_class != NULL);
2382 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2383 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2384 LDKEvent_PaymentForwarded_class =
2385 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2386 CHECK(LDKEvent_PaymentForwarded_class != NULL);
2387 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
2388 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2389 LDKEvent_ChannelClosed_class =
2390 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2391 CHECK(LDKEvent_ChannelClosed_class != NULL);
2392 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2393 CHECK(LDKEvent_ChannelClosed_meth != NULL);
2394 LDKEvent_DiscardFunding_class =
2395 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2396 CHECK(LDKEvent_DiscardFunding_class != NULL);
2397 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2398 CHECK(LDKEvent_DiscardFunding_meth != NULL);
2399 LDKEvent_PaymentPathSuccessful_class =
2400 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2401 CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2402 LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2403 CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2404 LDKEvent_OpenChannelRequest_class =
2405 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
2406 CHECK(LDKEvent_OpenChannelRequest_class != NULL);
2407 LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJ)V");
2408 CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
2410 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2411 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2413 case LDKEvent_FundingGenerationReady: {
2414 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2415 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2416 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2417 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2418 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2419 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);
2421 case LDKEvent_PaymentReceived: {
2422 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2423 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2424 uintptr_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
2425 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
2427 case LDKEvent_PaymentSent: {
2428 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2429 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2430 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2431 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2432 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2433 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2434 uintptr_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
2435 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2437 case LDKEvent_PaymentPathFailed: {
2438 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2439 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2440 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2441 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2442 uintptr_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
2443 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2444 int64_tArray path_arr = NULL;
2445 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2446 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2447 for (size_t k = 0; k < path_var.datalen; k++) {
2448 LDKRouteHop path_conv_10_var = path_var.data[k];
2449 uintptr_t path_conv_10_ref = 0;
2450 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2451 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2452 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2453 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2454 path_arr_ptr[k] = path_conv_10_ref;
2456 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2457 uintptr_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
2458 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2459 uintptr_t retry_ref = 0;
2460 if ((uintptr_t)retry_var.inner > 4096) {
2461 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2462 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2463 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2464 retry_ref = (uintptr_t)retry_var.inner & ~1;
2466 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);
2468 case LDKEvent_PaymentFailed: {
2469 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2470 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2471 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2472 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2473 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2475 case LDKEvent_PendingHTLCsForwardable: {
2476 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
2478 case LDKEvent_SpendableOutputs: {
2479 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2480 int64_tArray outputs_arr = NULL;
2481 outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2482 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2483 for (size_t b = 0; b < outputs_var.datalen; b++) {
2484 uintptr_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
2485 outputs_arr_ptr[b] = outputs_conv_27_ref;
2487 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2488 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2490 case LDKEvent_PaymentForwarded: {
2491 uintptr_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
2492 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
2494 case LDKEvent_ChannelClosed: {
2495 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2496 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2497 uintptr_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
2498 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, obj->channel_closed.user_channel_id, reason_ref);
2500 case LDKEvent_DiscardFunding: {
2501 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2502 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2503 LDKTransaction transaction_var = obj->discard_funding.transaction;
2504 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2505 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2506 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2508 case LDKEvent_PaymentPathSuccessful: {
2509 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2510 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2511 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2512 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2513 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2514 int64_tArray path_arr = NULL;
2515 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2516 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2517 for (size_t k = 0; k < path_var.datalen; k++) {
2518 LDKRouteHop path_conv_10_var = path_var.data[k];
2519 uintptr_t path_conv_10_ref = 0;
2520 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2521 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2522 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2523 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2524 path_arr_ptr[k] = path_conv_10_ref;
2526 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2527 return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2529 case LDKEvent_OpenChannelRequest: {
2530 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2531 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
2532 int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2533 (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
2534 return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, obj->open_channel_request.funding_satoshis, obj->open_channel_request.push_msat);
2539 static jclass LDKCOption_EventZ_Some_class = NULL;
2540 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2541 static jclass LDKCOption_EventZ_None_class = NULL;
2542 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2544 LDKCOption_EventZ_Some_class =
2545 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2546 CHECK(LDKCOption_EventZ_Some_class != NULL);
2547 LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2548 CHECK(LDKCOption_EventZ_Some_meth != NULL);
2549 LDKCOption_EventZ_None_class =
2550 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2551 CHECK(LDKCOption_EventZ_None_class != NULL);
2552 LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2553 CHECK(LDKCOption_EventZ_None_meth != NULL);
2555 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2556 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2558 case LDKCOption_EventZ_Some: {
2559 uintptr_t some_ref = ((uintptr_t)&obj->some) | 1;
2560 return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2562 case LDKCOption_EventZ_None: {
2563 return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2568 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2569 CHECK(owner->result_ok);
2570 return COption_EventZ_clone(&*owner->contents.result);
2572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2573 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2574 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2575 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2576 uintptr_t ret_ref = (uintptr_t)ret_copy;
2580 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2581 CHECK(!owner->result_ok);
2582 return DecodeError_clone(&*owner->contents.err);
2584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2585 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2586 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2587 uintptr_t ret_ref = 0;
2588 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2589 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2590 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2591 ret_ref = (uintptr_t)ret_var.inner;
2592 if (ret_var.is_owned) {
2598 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2599 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2600 static jclass LDKErrorAction_IgnoreError_class = NULL;
2601 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2602 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2603 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2604 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2605 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2606 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2607 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2608 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
2609 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
2610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2611 LDKErrorAction_DisconnectPeer_class =
2612 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2613 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2614 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2615 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2616 LDKErrorAction_IgnoreError_class =
2617 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2618 CHECK(LDKErrorAction_IgnoreError_class != NULL);
2619 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2620 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2621 LDKErrorAction_IgnoreAndLog_class =
2622 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2623 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2624 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2625 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2626 LDKErrorAction_IgnoreDuplicateGossip_class =
2627 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2628 CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2629 LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2630 CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2631 LDKErrorAction_SendErrorMessage_class =
2632 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2633 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2634 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2635 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2636 LDKErrorAction_SendWarningMessage_class =
2637 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
2638 CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
2639 LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
2640 CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
2642 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2643 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2645 case LDKErrorAction_DisconnectPeer: {
2646 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2647 uintptr_t msg_ref = 0;
2648 if ((uintptr_t)msg_var.inner > 4096) {
2649 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2650 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2651 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2652 msg_ref = (uintptr_t)msg_var.inner & ~1;
2654 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2656 case LDKErrorAction_IgnoreError: {
2657 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2659 case LDKErrorAction_IgnoreAndLog: {
2660 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2661 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2663 case LDKErrorAction_IgnoreDuplicateGossip: {
2664 return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2666 case LDKErrorAction_SendErrorMessage: {
2667 LDKErrorMessage msg_var = obj->send_error_message.msg;
2668 uintptr_t msg_ref = 0;
2669 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2670 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2671 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2672 msg_ref = (uintptr_t)msg_var.inner & ~1;
2673 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2675 case LDKErrorAction_SendWarningMessage: {
2676 LDKWarningMessage msg_var = obj->send_warning_message.msg;
2677 uintptr_t msg_ref = 0;
2678 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2679 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2680 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2681 msg_ref = (uintptr_t)msg_var.inner & ~1;
2682 jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
2683 return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
2688 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2689 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2690 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2691 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2692 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2693 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2694 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2695 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2696 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
2697 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
2698 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2699 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2700 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2701 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2702 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2703 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2704 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2705 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2706 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2707 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2708 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2709 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2710 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2711 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2712 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2713 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2714 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2715 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2716 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2717 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2718 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2719 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2720 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2721 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2722 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2723 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2724 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2725 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2727 LDKMessageSendEvent_SendAcceptChannel_class =
2728 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2729 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2730 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2731 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2732 LDKMessageSendEvent_SendOpenChannel_class =
2733 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2734 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2735 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2736 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2737 LDKMessageSendEvent_SendFundingCreated_class =
2738 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2739 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2740 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2741 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2742 LDKMessageSendEvent_SendFundingSigned_class =
2743 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2744 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2745 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2746 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2747 LDKMessageSendEvent_SendFundingLocked_class =
2748 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked"));
2749 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
2750 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
2751 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
2752 LDKMessageSendEvent_SendAnnouncementSignatures_class =
2753 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2754 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2755 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2756 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2757 LDKMessageSendEvent_UpdateHTLCs_class =
2758 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2759 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2760 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2761 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2762 LDKMessageSendEvent_SendRevokeAndACK_class =
2763 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2764 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2765 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2766 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2767 LDKMessageSendEvent_SendClosingSigned_class =
2768 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2769 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2770 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2771 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2772 LDKMessageSendEvent_SendShutdown_class =
2773 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2774 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2775 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2776 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2777 LDKMessageSendEvent_SendChannelReestablish_class =
2778 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2779 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2780 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2781 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2782 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2783 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2784 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2785 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2786 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2787 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2788 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2789 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2790 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2791 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2792 LDKMessageSendEvent_BroadcastChannelUpdate_class =
2793 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2794 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2795 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2796 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2797 LDKMessageSendEvent_SendChannelUpdate_class =
2798 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2799 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2800 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2801 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2802 LDKMessageSendEvent_HandleError_class =
2803 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2804 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2805 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2806 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2807 LDKMessageSendEvent_SendChannelRangeQuery_class =
2808 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2809 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2810 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2811 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2812 LDKMessageSendEvent_SendShortIdsQuery_class =
2813 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2814 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2815 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2816 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2817 LDKMessageSendEvent_SendReplyChannelRange_class =
2818 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2819 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2820 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2821 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2823 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2824 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2826 case LDKMessageSendEvent_SendAcceptChannel: {
2827 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2828 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2829 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2830 uintptr_t msg_ref = 0;
2831 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2832 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2833 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2834 msg_ref = (uintptr_t)msg_var.inner & ~1;
2835 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2837 case LDKMessageSendEvent_SendOpenChannel: {
2838 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2839 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2840 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2841 uintptr_t msg_ref = 0;
2842 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2843 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2844 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2845 msg_ref = (uintptr_t)msg_var.inner & ~1;
2846 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2848 case LDKMessageSendEvent_SendFundingCreated: {
2849 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2850 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2851 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2852 uintptr_t msg_ref = 0;
2853 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2854 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2855 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2856 msg_ref = (uintptr_t)msg_var.inner & ~1;
2857 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2859 case LDKMessageSendEvent_SendFundingSigned: {
2860 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2861 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2862 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2863 uintptr_t msg_ref = 0;
2864 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2865 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2866 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2867 msg_ref = (uintptr_t)msg_var.inner & ~1;
2868 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2870 case LDKMessageSendEvent_SendFundingLocked: {
2871 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2872 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
2873 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2874 uintptr_t msg_ref = 0;
2875 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2876 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2877 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2878 msg_ref = (uintptr_t)msg_var.inner & ~1;
2879 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
2881 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2882 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2883 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2884 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2885 uintptr_t msg_ref = 0;
2886 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2887 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2888 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2889 msg_ref = (uintptr_t)msg_var.inner & ~1;
2890 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
2892 case LDKMessageSendEvent_UpdateHTLCs: {
2893 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2894 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
2895 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2896 uintptr_t updates_ref = 0;
2897 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2898 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2899 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2900 updates_ref = (uintptr_t)updates_var.inner & ~1;
2901 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
2903 case LDKMessageSendEvent_SendRevokeAndACK: {
2904 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2905 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
2906 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2907 uintptr_t msg_ref = 0;
2908 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2909 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2910 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2911 msg_ref = (uintptr_t)msg_var.inner & ~1;
2912 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
2914 case LDKMessageSendEvent_SendClosingSigned: {
2915 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2916 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
2917 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2918 uintptr_t msg_ref = 0;
2919 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2920 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2921 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2922 msg_ref = (uintptr_t)msg_var.inner & ~1;
2923 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
2925 case LDKMessageSendEvent_SendShutdown: {
2926 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2927 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
2928 LDKShutdown msg_var = obj->send_shutdown.msg;
2929 uintptr_t msg_ref = 0;
2930 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2931 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2932 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2933 msg_ref = (uintptr_t)msg_var.inner & ~1;
2934 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
2936 case LDKMessageSendEvent_SendChannelReestablish: {
2937 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2938 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
2939 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2940 uintptr_t msg_ref = 0;
2941 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2942 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2943 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2944 msg_ref = (uintptr_t)msg_var.inner & ~1;
2945 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
2947 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2948 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2949 uintptr_t msg_ref = 0;
2950 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2951 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2952 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2953 msg_ref = (uintptr_t)msg_var.inner & ~1;
2954 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2955 uintptr_t update_msg_ref = 0;
2956 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2957 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2958 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2959 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
2960 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
2962 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2963 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2964 uintptr_t msg_ref = 0;
2965 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2966 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2967 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2968 msg_ref = (uintptr_t)msg_var.inner & ~1;
2969 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
2971 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2972 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2973 uintptr_t msg_ref = 0;
2974 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2975 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2976 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2977 msg_ref = (uintptr_t)msg_var.inner & ~1;
2978 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
2980 case LDKMessageSendEvent_SendChannelUpdate: {
2981 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2982 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
2983 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2984 uintptr_t msg_ref = 0;
2985 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2986 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2987 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2988 msg_ref = (uintptr_t)msg_var.inner & ~1;
2989 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
2991 case LDKMessageSendEvent_HandleError: {
2992 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2993 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
2994 uintptr_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
2995 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
2997 case LDKMessageSendEvent_SendChannelRangeQuery: {
2998 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2999 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
3000 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3001 uintptr_t msg_ref = 0;
3002 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3003 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3004 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3005 msg_ref = (uintptr_t)msg_var.inner & ~1;
3006 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
3008 case LDKMessageSendEvent_SendShortIdsQuery: {
3009 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3010 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
3011 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3012 uintptr_t msg_ref = 0;
3013 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3014 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3015 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3016 msg_ref = (uintptr_t)msg_var.inner & ~1;
3017 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
3019 case LDKMessageSendEvent_SendReplyChannelRange: {
3020 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3021 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
3022 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3023 uintptr_t msg_ref = 0;
3024 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3025 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3026 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3027 msg_ref = (uintptr_t)msg_var.inner & ~1;
3028 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
3033 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3034 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3035 for (size_t i = 0; i < ret.datalen; i++) {
3036 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3040 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3041 CHECK(owner->result_ok);
3042 return FixedPenaltyScorer_clone(&*owner->contents.result);
3044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3045 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3046 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3047 uintptr_t ret_ref = 0;
3048 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3049 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3050 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3051 ret_ref = (uintptr_t)ret_var.inner;
3052 if (ret_var.is_owned) {
3058 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3059 CHECK(!owner->result_ok);
3060 return DecodeError_clone(&*owner->contents.err);
3062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3063 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3064 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3065 uintptr_t ret_ref = 0;
3066 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3067 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3068 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3069 ret_ref = (uintptr_t)ret_var.inner;
3070 if (ret_var.is_owned) {
3076 static inline struct LDKScoringParameters CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3077 CHECK(owner->result_ok);
3078 return ScoringParameters_clone(&*owner->contents.result);
3080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3081 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3082 LDKScoringParameters ret_var = CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv);
3083 uintptr_t ret_ref = 0;
3084 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3085 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3087 ret_ref = (uintptr_t)ret_var.inner;
3088 if (ret_var.is_owned) {
3094 static inline struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3095 CHECK(!owner->result_ok);
3096 return DecodeError_clone(&*owner->contents.err);
3098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3099 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3100 LDKDecodeError ret_var = CResult_ScoringParametersDecodeErrorZ_get_err(owner_conv);
3101 uintptr_t ret_ref = 0;
3102 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3103 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3105 ret_ref = (uintptr_t)ret_var.inner;
3106 if (ret_var.is_owned) {
3112 static inline struct LDKScorer *CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
3113 CHECK(owner->result_ok);
3114 return &*owner->contents.result;
3116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3117 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
3118 LDKScorer ret_var = *CResult_ScorerDecodeErrorZ_get_ok(owner_conv);
3119 uintptr_t ret_ref = 0;
3120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3123 ret_ref = (uintptr_t)ret_var.inner & ~1;
3127 static inline struct LDKDecodeError CResult_ScorerDecodeErrorZ_get_err(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
3128 CHECK(!owner->result_ok);
3129 return DecodeError_clone(&*owner->contents.err);
3131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3132 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
3133 LDKDecodeError ret_var = CResult_ScorerDecodeErrorZ_get_err(owner_conv);
3134 uintptr_t ret_ref = 0;
3135 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3136 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3137 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3138 ret_ref = (uintptr_t)ret_var.inner;
3139 if (ret_var.is_owned) {
3145 static inline struct LDKProbabilisticScoringParameters CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3146 CHECK(owner->result_ok);
3147 return ProbabilisticScoringParameters_clone(&*owner->contents.result);
3149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3150 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1);
3151 LDKProbabilisticScoringParameters ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(owner_conv);
3152 uintptr_t ret_ref = 0;
3153 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3154 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3156 ret_ref = (uintptr_t)ret_var.inner;
3157 if (ret_var.is_owned) {
3163 static inline struct LDKDecodeError CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3164 CHECK(!owner->result_ok);
3165 return DecodeError_clone(&*owner->contents.err);
3167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3168 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1);
3169 LDKDecodeError ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(owner_conv);
3170 uintptr_t ret_ref = 0;
3171 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3172 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3174 ret_ref = (uintptr_t)ret_var.inner;
3175 if (ret_var.is_owned) {
3181 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3182 CHECK(owner->result_ok);
3183 return InitFeatures_clone(&*owner->contents.result);
3185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3186 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3187 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3188 uintptr_t ret_ref = 0;
3189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3192 ret_ref = (uintptr_t)ret_var.inner;
3193 if (ret_var.is_owned) {
3199 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3200 CHECK(!owner->result_ok);
3201 return DecodeError_clone(&*owner->contents.err);
3203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3204 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3205 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3206 uintptr_t ret_ref = 0;
3207 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3208 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3209 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3210 ret_ref = (uintptr_t)ret_var.inner;
3211 if (ret_var.is_owned) {
3217 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3218 CHECK(owner->result_ok);
3219 return ChannelFeatures_clone(&*owner->contents.result);
3221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3222 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3223 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3224 uintptr_t ret_ref = 0;
3225 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3226 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3228 ret_ref = (uintptr_t)ret_var.inner;
3229 if (ret_var.is_owned) {
3235 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3236 CHECK(!owner->result_ok);
3237 return DecodeError_clone(&*owner->contents.err);
3239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3240 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3241 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3242 uintptr_t ret_ref = 0;
3243 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3244 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3245 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3246 ret_ref = (uintptr_t)ret_var.inner;
3247 if (ret_var.is_owned) {
3253 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3254 CHECK(owner->result_ok);
3255 return NodeFeatures_clone(&*owner->contents.result);
3257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3258 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3259 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(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 struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3272 CHECK(!owner->result_ok);
3273 return DecodeError_clone(&*owner->contents.err);
3275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3276 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3277 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3278 uintptr_t ret_ref = 0;
3279 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3280 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3282 ret_ref = (uintptr_t)ret_var.inner;
3283 if (ret_var.is_owned) {
3289 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3290 CHECK(owner->result_ok);
3291 return InvoiceFeatures_clone(&*owner->contents.result);
3293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3294 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3295 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3296 uintptr_t ret_ref = 0;
3297 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3298 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3300 ret_ref = (uintptr_t)ret_var.inner;
3301 if (ret_var.is_owned) {
3307 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3308 CHECK(!owner->result_ok);
3309 return DecodeError_clone(&*owner->contents.err);
3311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3312 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3313 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3314 uintptr_t ret_ref = 0;
3315 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3316 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3317 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3318 ret_ref = (uintptr_t)ret_var.inner;
3319 if (ret_var.is_owned) {
3325 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3326 CHECK(owner->result_ok);
3327 return ChannelTypeFeatures_clone(&*owner->contents.result);
3329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3330 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3331 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3332 uintptr_t ret_ref = 0;
3333 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3334 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3335 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3336 ret_ref = (uintptr_t)ret_var.inner;
3337 if (ret_var.is_owned) {
3343 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3344 CHECK(!owner->result_ok);
3345 return DecodeError_clone(&*owner->contents.err);
3347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3348 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3349 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3350 uintptr_t ret_ref = 0;
3351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3354 ret_ref = (uintptr_t)ret_var.inner;
3355 if (ret_var.is_owned) {
3361 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3362 CHECK(owner->result_ok);
3363 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
3365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3366 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3367 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3368 uintptr_t ret_ref = 0;
3369 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3370 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3372 ret_ref = (uintptr_t)ret_var.inner;
3373 if (ret_var.is_owned) {
3379 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3380 CHECK(!owner->result_ok);
3381 return DecodeError_clone(&*owner->contents.err);
3383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3384 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3385 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3386 uintptr_t ret_ref = 0;
3387 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3388 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3389 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3390 ret_ref = (uintptr_t)ret_var.inner;
3391 if (ret_var.is_owned) {
3397 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3398 CHECK(owner->result_ok);
3399 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
3401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3402 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3403 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3404 uintptr_t ret_ref = 0;
3405 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3406 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3408 ret_ref = (uintptr_t)ret_var.inner;
3409 if (ret_var.is_owned) {
3415 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3416 CHECK(!owner->result_ok);
3417 return DecodeError_clone(&*owner->contents.err);
3419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3420 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3421 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3422 uintptr_t ret_ref = 0;
3423 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3424 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3426 ret_ref = (uintptr_t)ret_var.inner;
3427 if (ret_var.is_owned) {
3433 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3434 CHECK(owner->result_ok);
3435 return SpendableOutputDescriptor_clone(&*owner->contents.result);
3437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3438 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3439 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3440 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3441 uintptr_t ret_ref = (uintptr_t)ret_copy;
3445 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3446 CHECK(!owner->result_ok);
3447 return DecodeError_clone(&*owner->contents.err);
3449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3450 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3451 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3452 uintptr_t ret_ref = 0;
3453 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3454 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3456 ret_ref = (uintptr_t)ret_var.inner;
3457 if (ret_var.is_owned) {
3463 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3464 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3465 for (size_t i = 0; i < ret.datalen; i++) {
3466 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3470 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3474 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3475 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3476 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
3480 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3483 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3484 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3485 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3486 jobjectArray ret_arr = NULL;
3487 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3489 for (size_t i = 0; i < ret_var.datalen; i++) {
3490 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
3491 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
3492 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3498 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3499 CHECK(owner->result_ok);
3500 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3503 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3504 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3505 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3506 return ((uintptr_t)ret_conv);
3509 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3510 CHECK(!owner->result_ok);
3511 return *owner->contents.err;
3513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3514 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3515 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3518 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3519 CHECK(owner->result_ok);
3520 return *owner->contents.result;
3522 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3523 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3524 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3525 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
3529 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3530 CHECK(!owner->result_ok);
3531 return *owner->contents.err;
3533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3534 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3535 CResult_SignatureNoneZ_get_err(owner_conv);
3538 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3542 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3543 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3544 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
3548 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3552 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3553 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3554 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
3558 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3559 CHECK(owner->result_ok);
3560 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3563 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3564 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3565 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3566 return ((uintptr_t)ret_conv);
3569 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3570 CHECK(!owner->result_ok);
3571 return *owner->contents.err;
3573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3574 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3575 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3578 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3579 CHECK(owner->result_ok);
3580 return *owner->contents.result;
3582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3583 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3584 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3585 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
3589 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3590 CHECK(!owner->result_ok);
3591 return *owner->contents.err;
3593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3594 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3595 CResult_SecretKeyNoneZ_get_err(owner_conv);
3598 typedef struct LDKBaseSign_JCalls {
3599 atomic_size_t refcnt;
3602 jmethodID get_per_commitment_point_meth;
3603 jmethodID release_commitment_secret_meth;
3604 jmethodID validate_holder_commitment_meth;
3605 jmethodID channel_keys_id_meth;
3606 jmethodID sign_counterparty_commitment_meth;
3607 jmethodID validate_counterparty_revocation_meth;
3608 jmethodID sign_holder_commitment_and_htlcs_meth;
3609 jmethodID sign_justice_revoked_output_meth;
3610 jmethodID sign_justice_revoked_htlc_meth;
3611 jmethodID sign_counterparty_htlc_transaction_meth;
3612 jmethodID sign_closing_transaction_meth;
3613 jmethodID sign_channel_announcement_meth;
3614 jmethodID ready_channel_meth;
3615 } LDKBaseSign_JCalls;
3616 static void LDKBaseSign_JCalls_free(void* this_arg) {
3617 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3618 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3620 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3621 if (get_jenv_res == JNI_EDETACHED) {
3622 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3624 DO_ASSERT(get_jenv_res == JNI_OK);
3626 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3627 if (get_jenv_res == JNI_EDETACHED) {
3628 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3633 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3634 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3636 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3637 if (get_jenv_res == JNI_EDETACHED) {
3638 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3640 DO_ASSERT(get_jenv_res == JNI_OK);
3642 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3644 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
3645 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3646 (*env)->ExceptionDescribe(env);
3647 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
3649 LDKPublicKey ret_ref;
3650 CHECK((*env)->GetArrayLength(env, ret) == 33);
3651 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3652 if (get_jenv_res == JNI_EDETACHED) {
3653 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3657 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3658 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3660 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3661 if (get_jenv_res == JNI_EDETACHED) {
3662 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3664 DO_ASSERT(get_jenv_res == JNI_OK);
3666 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3668 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
3669 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3670 (*env)->ExceptionDescribe(env);
3671 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
3673 LDKThirtyTwoBytes ret_ref;
3674 CHECK((*env)->GetArrayLength(env, ret) == 32);
3675 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3676 if (get_jenv_res == JNI_EDETACHED) {
3677 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3681 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3682 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3684 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3685 if (get_jenv_res == JNI_EDETACHED) {
3686 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3688 DO_ASSERT(get_jenv_res == JNI_OK);
3690 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3691 uintptr_t holder_tx_ref = 0;
3692 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
3693 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3694 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3695 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3696 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
3697 if (holder_tx_var.is_owned) {
3700 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3701 jobjectArray preimages_arr = NULL;
3702 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
3704 for (size_t i = 0; i < preimages_var.datalen; i++) {
3705 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3706 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
3707 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
3710 FREE(preimages_var.data);
3711 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3713 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
3714 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3715 (*env)->ExceptionDescribe(env);
3716 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
3718 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3719 CHECK_ACCESS(ret_ptr);
3720 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3722 if (get_jenv_res == JNI_EDETACHED) {
3723 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3727 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3728 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3730 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3731 if (get_jenv_res == JNI_EDETACHED) {
3732 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3734 DO_ASSERT(get_jenv_res == JNI_OK);
3736 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3738 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
3739 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3740 (*env)->ExceptionDescribe(env);
3741 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
3743 LDKThirtyTwoBytes ret_ref;
3744 CHECK((*env)->GetArrayLength(env, ret) == 32);
3745 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3746 if (get_jenv_res == JNI_EDETACHED) {
3747 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3751 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3752 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3754 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3755 if (get_jenv_res == JNI_EDETACHED) {
3756 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3758 DO_ASSERT(get_jenv_res == JNI_OK);
3760 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3761 uintptr_t commitment_tx_ref = 0;
3762 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
3763 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3764 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3765 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3766 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3767 if (commitment_tx_var.is_owned) {
3768 commitment_tx_ref |= 1;
3770 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3771 jobjectArray preimages_arr = NULL;
3772 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
3774 for (size_t i = 0; i < preimages_var.datalen; i++) {
3775 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3776 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
3777 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
3780 FREE(preimages_var.data);
3781 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3783 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
3784 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3785 (*env)->ExceptionDescribe(env);
3786 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
3788 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3789 CHECK_ACCESS(ret_ptr);
3790 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3792 if (get_jenv_res == JNI_EDETACHED) {
3793 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3797 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3798 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3800 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3801 if (get_jenv_res == JNI_EDETACHED) {
3802 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3804 DO_ASSERT(get_jenv_res == JNI_OK);
3806 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
3807 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
3808 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3810 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
3811 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3812 (*env)->ExceptionDescribe(env);
3813 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
3815 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3816 CHECK_ACCESS(ret_ptr);
3817 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3819 if (get_jenv_res == JNI_EDETACHED) {
3820 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3824 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3825 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3827 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3828 if (get_jenv_res == JNI_EDETACHED) {
3829 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3831 DO_ASSERT(get_jenv_res == JNI_OK);
3833 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3834 uintptr_t commitment_tx_ref = 0;
3835 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
3836 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3837 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3838 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3839 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3840 if (commitment_tx_var.is_owned) {
3841 commitment_tx_ref |= 1;
3843 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3845 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
3846 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3847 (*env)->ExceptionDescribe(env);
3848 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
3850 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3851 CHECK_ACCESS(ret_ptr);
3852 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3854 if (get_jenv_res == JNI_EDETACHED) {
3855 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3859 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]) {
3860 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3862 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3863 if (get_jenv_res == JNI_EDETACHED) {
3864 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3866 DO_ASSERT(get_jenv_res == JNI_OK);
3868 LDKTransaction justice_tx_var = justice_tx;
3869 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3870 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3871 Transaction_free(justice_tx_var);
3872 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3873 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3874 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3876 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
3877 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3878 (*env)->ExceptionDescribe(env);
3879 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
3881 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3882 CHECK_ACCESS(ret_ptr);
3883 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3885 if (get_jenv_res == JNI_EDETACHED) {
3886 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3890 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) {
3891 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3893 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3894 if (get_jenv_res == JNI_EDETACHED) {
3895 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3897 DO_ASSERT(get_jenv_res == JNI_OK);
3899 LDKTransaction justice_tx_var = justice_tx;
3900 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3901 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3902 Transaction_free(justice_tx_var);
3903 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3904 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3905 LDKHTLCOutputInCommitment htlc_var = *htlc;
3906 uintptr_t htlc_ref = 0;
3907 htlc_var = HTLCOutputInCommitment_clone(htlc);
3908 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3909 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3910 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3911 htlc_ref = (uintptr_t)htlc_var.inner;
3912 if (htlc_var.is_owned) {
3915 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3917 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);
3918 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3919 (*env)->ExceptionDescribe(env);
3920 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
3922 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3923 CHECK_ACCESS(ret_ptr);
3924 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3926 if (get_jenv_res == JNI_EDETACHED) {
3927 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3931 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) {
3932 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3934 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3935 if (get_jenv_res == JNI_EDETACHED) {
3936 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3938 DO_ASSERT(get_jenv_res == JNI_OK);
3940 LDKTransaction htlc_tx_var = htlc_tx;
3941 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3942 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3943 Transaction_free(htlc_tx_var);
3944 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3945 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3946 LDKHTLCOutputInCommitment htlc_var = *htlc;
3947 uintptr_t htlc_ref = 0;
3948 htlc_var = HTLCOutputInCommitment_clone(htlc);
3949 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3950 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3951 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3952 htlc_ref = (uintptr_t)htlc_var.inner;
3953 if (htlc_var.is_owned) {
3956 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3958 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);
3959 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3960 (*env)->ExceptionDescribe(env);
3961 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
3963 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3964 CHECK_ACCESS(ret_ptr);
3965 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3967 if (get_jenv_res == JNI_EDETACHED) {
3968 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3972 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3973 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3975 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3976 if (get_jenv_res == JNI_EDETACHED) {
3977 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3979 DO_ASSERT(get_jenv_res == JNI_OK);
3981 LDKClosingTransaction closing_tx_var = *closing_tx;
3982 uintptr_t closing_tx_ref = 0;
3983 closing_tx_var = ClosingTransaction_clone(closing_tx);
3984 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3985 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3986 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3987 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
3988 if (closing_tx_var.is_owned) {
3989 closing_tx_ref |= 1;
3991 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3993 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3994 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3995 (*env)->ExceptionDescribe(env);
3996 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
3998 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3999 CHECK_ACCESS(ret_ptr);
4000 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4002 if (get_jenv_res == JNI_EDETACHED) {
4003 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4007 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4008 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4010 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4011 if (get_jenv_res == JNI_EDETACHED) {
4012 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4014 DO_ASSERT(get_jenv_res == JNI_OK);
4016 LDKUnsignedChannelAnnouncement msg_var = *msg;
4017 uintptr_t msg_ref = 0;
4018 msg_var = UnsignedChannelAnnouncement_clone(msg);
4019 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4020 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4021 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4022 msg_ref = (uintptr_t)msg_var.inner;
4023 if (msg_var.is_owned) {
4026 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4028 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
4029 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4030 (*env)->ExceptionDescribe(env);
4031 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
4033 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4034 CHECK_ACCESS(ret_ptr);
4035 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4037 if (get_jenv_res == JNI_EDETACHED) {
4038 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4042 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4043 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4045 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4046 if (get_jenv_res == JNI_EDETACHED) {
4047 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4049 DO_ASSERT(get_jenv_res == JNI_OK);
4051 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4052 uintptr_t channel_parameters_ref = 0;
4053 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
4054 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4055 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4056 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4057 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
4058 if (channel_parameters_var.is_owned) {
4059 channel_parameters_ref |= 1;
4061 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4063 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
4064 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4065 (*env)->ExceptionDescribe(env);
4066 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
4068 if (get_jenv_res == JNI_EDETACHED) {
4069 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4072 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4073 jclass c = (*env)->GetObjectClass(env, o);
4075 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4076 atomic_init(&calls->refcnt, 1);
4077 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4078 calls->o = (*env)->NewWeakGlobalRef(env, o);
4079 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
4080 CHECK(calls->get_per_commitment_point_meth != NULL);
4081 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
4082 CHECK(calls->release_commitment_secret_meth != NULL);
4083 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
4084 CHECK(calls->validate_holder_commitment_meth != NULL);
4085 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
4086 CHECK(calls->channel_keys_id_meth != NULL);
4087 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
4088 CHECK(calls->sign_counterparty_commitment_meth != NULL);
4089 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
4090 CHECK(calls->validate_counterparty_revocation_meth != NULL);
4091 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
4092 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
4093 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
4094 CHECK(calls->sign_justice_revoked_output_meth != NULL);
4095 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
4096 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
4097 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
4098 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
4099 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
4100 CHECK(calls->sign_closing_transaction_meth != NULL);
4101 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
4102 CHECK(calls->sign_channel_announcement_meth != NULL);
4103 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
4104 CHECK(calls->ready_channel_meth != NULL);
4106 LDKChannelPublicKeys pubkeys_conv;
4107 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4108 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4109 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4112 .this_arg = (void*) calls,
4113 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4114 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4115 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4116 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4117 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4118 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4119 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4120 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4121 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
4122 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
4123 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
4124 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
4125 .ready_channel = ready_channel_LDKBaseSign_jcall,
4126 .free = LDKBaseSign_JCalls_free,
4127 .pubkeys = pubkeys_conv,
4128 .set_pubkeys = NULL,
4132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4133 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
4134 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
4135 return (uint64_t)res_ptr;
4137 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) {
4138 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4139 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4140 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4141 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4142 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
4146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
4147 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4148 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4149 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4150 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4151 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
4155 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, jobjectArray preimages) {
4156 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4157 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4158 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4159 LDKHolderCommitmentTransaction holder_tx_conv;
4160 holder_tx_conv.inner = (void*)(holder_tx & (~1));
4161 holder_tx_conv.is_owned = false;
4162 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4163 LDKCVec_PaymentPreimageZ preimages_constr;
4164 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4165 if (preimages_constr.datalen > 0)
4166 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4168 preimages_constr.data = NULL;
4169 for (size_t i = 0; i < preimages_constr.datalen; i++) {
4170 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4171 LDKThirtyTwoBytes preimages_conv_8_ref;
4172 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4173 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4174 preimages_constr.data[i] = preimages_conv_8_ref;
4176 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4177 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4178 return (uintptr_t)ret_conv;
4181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4182 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4183 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4184 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4185 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4186 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
4190 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, jobjectArray preimages) {
4191 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4192 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4193 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4194 LDKCommitmentTransaction commitment_tx_conv;
4195 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4196 commitment_tx_conv.is_owned = false;
4197 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4198 LDKCVec_PaymentPreimageZ preimages_constr;
4199 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4200 if (preimages_constr.datalen > 0)
4201 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4203 preimages_constr.data = NULL;
4204 for (size_t i = 0; i < preimages_constr.datalen; i++) {
4205 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4206 LDKThirtyTwoBytes preimages_conv_8_ref;
4207 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4208 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4209 preimages_constr.data[i] = preimages_conv_8_ref;
4211 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4212 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4213 return (uintptr_t)ret_conv;
4216 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) {
4217 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4218 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4219 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4220 unsigned char secret_arr[32];
4221 CHECK((*env)->GetArrayLength(env, secret) == 32);
4222 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
4223 unsigned char (*secret_ref)[32] = &secret_arr;
4224 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4225 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4226 return (uintptr_t)ret_conv;
4229 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) {
4230 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4231 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4232 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4233 LDKHolderCommitmentTransaction commitment_tx_conv;
4234 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4235 commitment_tx_conv.is_owned = false;
4236 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4237 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4238 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4239 return (uintptr_t)ret_conv;
4242 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) {
4243 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4244 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4245 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4246 LDKTransaction justice_tx_ref;
4247 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
4248 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4249 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
4250 justice_tx_ref.data_is_owned = true;
4251 unsigned char per_commitment_key_arr[32];
4252 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
4253 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
4254 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4255 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4256 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4257 return (uintptr_t)ret_conv;
4260 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) {
4261 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4262 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4263 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4264 LDKTransaction justice_tx_ref;
4265 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
4266 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4267 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
4268 justice_tx_ref.data_is_owned = true;
4269 unsigned char per_commitment_key_arr[32];
4270 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
4271 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
4272 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4273 LDKHTLCOutputInCommitment htlc_conv;
4274 htlc_conv.inner = (void*)(htlc & (~1));
4275 htlc_conv.is_owned = false;
4276 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4277 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4278 *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);
4279 return (uintptr_t)ret_conv;
4282 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) {
4283 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4284 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4285 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4286 LDKTransaction htlc_tx_ref;
4287 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
4288 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4289 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
4290 htlc_tx_ref.data_is_owned = true;
4291 LDKPublicKey per_commitment_point_ref;
4292 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
4293 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
4294 LDKHTLCOutputInCommitment htlc_conv;
4295 htlc_conv.inner = (void*)(htlc & (~1));
4296 htlc_conv.is_owned = false;
4297 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4298 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4299 *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);
4300 return (uintptr_t)ret_conv;
4303 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) {
4304 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4305 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4306 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4307 LDKClosingTransaction closing_tx_conv;
4308 closing_tx_conv.inner = (void*)(closing_tx & (~1));
4309 closing_tx_conv.is_owned = false;
4310 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4311 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4312 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4313 return (uintptr_t)ret_conv;
4316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
4317 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4318 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4319 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4320 LDKUnsignedChannelAnnouncement msg_conv;
4321 msg_conv.inner = (void*)(msg & (~1));
4322 msg_conv.is_owned = false;
4323 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4324 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4325 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4326 return (uintptr_t)ret_conv;
4329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
4330 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4331 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4332 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4333 LDKChannelTransactionParameters channel_parameters_conv;
4334 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
4335 channel_parameters_conv.is_owned = false;
4336 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4337 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4340 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4341 if (this_arg->set_pubkeys != NULL)
4342 this_arg->set_pubkeys(this_arg);
4343 return this_arg->pubkeys;
4345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
4346 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4347 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4348 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4349 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4350 uintptr_t ret_ref = 0;
4351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4354 ret_ref = (uintptr_t)ret_var.inner;
4355 if (ret_var.is_owned) {
4361 typedef struct LDKSign_JCalls {
4362 atomic_size_t refcnt;
4365 LDKBaseSign_JCalls* BaseSign;
4366 jmethodID write_meth;
4368 static void LDKSign_JCalls_free(void* this_arg) {
4369 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4370 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4372 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4373 if (get_jenv_res == JNI_EDETACHED) {
4374 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4376 DO_ASSERT(get_jenv_res == JNI_OK);
4378 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4379 if (get_jenv_res == JNI_EDETACHED) {
4380 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4385 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4386 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4388 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4389 if (get_jenv_res == JNI_EDETACHED) {
4390 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4392 DO_ASSERT(get_jenv_res == JNI_OK);
4394 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4396 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4397 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4398 (*env)->ExceptionDescribe(env);
4399 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
4401 LDKCVec_u8Z ret_ref;
4402 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4403 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4404 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4405 if (get_jenv_res == JNI_EDETACHED) {
4406 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4410 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4411 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4412 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4413 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4415 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
4416 jclass c = (*env)->GetObjectClass(env, o);
4418 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4419 atomic_init(&calls->refcnt, 1);
4420 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4421 calls->o = (*env)->NewWeakGlobalRef(env, o);
4422 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4423 CHECK(calls->write_meth != NULL);
4425 LDKChannelPublicKeys pubkeys_conv;
4426 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4427 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4428 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4431 .this_arg = (void*) calls,
4432 .write = write_LDKSign_jcall,
4433 .cloned = LDKSign_JCalls_cloned,
4434 .free = LDKSign_JCalls_free,
4435 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
4437 calls->BaseSign = ret.BaseSign.this_arg;
4440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
4441 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4442 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
4443 return (uint64_t)res_ptr;
4445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
4446 LDKSign *inp = (LDKSign *)(arg & ~1);
4447 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
4448 DO_ASSERT((res_ptr & 1) == 0);
4449 return (int64_t)(res_ptr | 1);
4451 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4452 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4453 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4454 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4455 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4456 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4457 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4458 CVec_u8Z_free(ret_var);
4462 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4463 CHECK(owner->result_ok);
4464 return Sign_clone(&*owner->contents.result);
4466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4467 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4468 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4469 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4470 return (uintptr_t)ret_ret;
4473 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4474 CHECK(!owner->result_ok);
4475 return DecodeError_clone(&*owner->contents.err);
4477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4478 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4479 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4480 uintptr_t ret_ref = 0;
4481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4484 ret_ref = (uintptr_t)ret_var.inner;
4485 if (ret_var.is_owned) {
4491 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4492 CHECK(owner->result_ok);
4493 return *owner->contents.result;
4495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4496 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4497 int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
4498 (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
4502 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4503 CHECK(!owner->result_ok);
4504 return *owner->contents.err;
4506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4507 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4508 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4511 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4512 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4513 for (size_t i = 0; i < ret.datalen; i++) {
4514 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4518 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4519 CHECK(owner->result_ok);
4520 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4522 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4523 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4524 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4525 jobjectArray ret_arr = NULL;
4526 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4528 for (size_t i = 0; i < ret_var.datalen; i++) {
4529 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
4530 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
4531 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
4532 CVec_u8Z_free(ret_conv_8_var);
4533 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4540 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4541 CHECK(!owner->result_ok);
4542 return *owner->contents.err;
4544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4545 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4546 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4549 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4550 CHECK(owner->result_ok);
4551 return InMemorySigner_clone(&*owner->contents.result);
4553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4554 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4555 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4556 uintptr_t ret_ref = 0;
4557 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4558 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4560 ret_ref = (uintptr_t)ret_var.inner;
4561 if (ret_var.is_owned) {
4567 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4568 CHECK(!owner->result_ok);
4569 return DecodeError_clone(&*owner->contents.err);
4571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4572 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4573 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4574 uintptr_t ret_ref = 0;
4575 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4576 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4578 ret_ref = (uintptr_t)ret_var.inner;
4579 if (ret_var.is_owned) {
4585 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4586 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4587 for (size_t i = 0; i < ret.datalen; i++) {
4588 ret.data[i] = TxOut_clone(&orig->data[i]);
4592 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4593 CHECK(owner->result_ok);
4594 return *owner->contents.result;
4596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4597 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4598 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4599 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4600 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4604 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4605 CHECK(!owner->result_ok);
4606 return *owner->contents.err;
4608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4609 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4610 CResult_TransactionNoneZ_get_err(owner_conv);
4613 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
4614 return ThirtyTwoBytes_clone(&owner->a);
4616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4617 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
4618 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4619 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
4623 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
4624 return ChannelMonitor_clone(&owner->b);
4626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4627 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
4628 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
4629 uintptr_t ret_ref = 0;
4630 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4631 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4633 ret_ref = (uintptr_t)ret_var.inner;
4634 if (ret_var.is_owned) {
4640 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
4641 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
4642 for (size_t i = 0; i < ret.datalen; i++) {
4643 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
4647 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
4648 CHECK(owner->result_ok);
4649 return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
4651 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4652 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
4653 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
4654 int64_tArray ret_arr = NULL;
4655 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4656 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4657 for (size_t j = 0; j < ret_var.datalen; j++) {
4658 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4659 *ret_conv_35_conv = ret_var.data[j];
4660 ret_arr_ptr[j] = ((uintptr_t)ret_conv_35_conv);
4662 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4667 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
4668 CHECK(!owner->result_ok);
4669 return *owner->contents.err;
4671 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4672 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
4673 jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
4677 static jclass LDKCOption_u16Z_Some_class = NULL;
4678 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
4679 static jclass LDKCOption_u16Z_None_class = NULL;
4680 static jmethodID LDKCOption_u16Z_None_meth = NULL;
4681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
4682 LDKCOption_u16Z_Some_class =
4683 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
4684 CHECK(LDKCOption_u16Z_Some_class != NULL);
4685 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
4686 CHECK(LDKCOption_u16Z_Some_meth != NULL);
4687 LDKCOption_u16Z_None_class =
4688 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
4689 CHECK(LDKCOption_u16Z_None_class != NULL);
4690 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
4691 CHECK(LDKCOption_u16Z_None_meth != NULL);
4693 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4694 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4696 case LDKCOption_u16Z_Some: {
4697 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
4699 case LDKCOption_u16Z_None: {
4700 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
4705 static jclass LDKAPIError_APIMisuseError_class = NULL;
4706 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
4707 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
4708 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
4709 static jclass LDKAPIError_RouteError_class = NULL;
4710 static jmethodID LDKAPIError_RouteError_meth = NULL;
4711 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
4712 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
4713 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
4714 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
4715 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
4716 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
4717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
4718 LDKAPIError_APIMisuseError_class =
4719 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
4720 CHECK(LDKAPIError_APIMisuseError_class != NULL);
4721 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
4722 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
4723 LDKAPIError_FeeRateTooHigh_class =
4724 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
4725 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
4726 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
4727 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
4728 LDKAPIError_RouteError_class =
4729 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
4730 CHECK(LDKAPIError_RouteError_class != NULL);
4731 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
4732 CHECK(LDKAPIError_RouteError_meth != NULL);
4733 LDKAPIError_ChannelUnavailable_class =
4734 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
4735 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
4736 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
4737 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
4738 LDKAPIError_MonitorUpdateFailed_class =
4739 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
4740 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
4741 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
4742 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
4743 LDKAPIError_IncompatibleShutdownScript_class =
4744 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
4745 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
4746 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
4747 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
4749 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4750 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4752 case LDKAPIError_APIMisuseError: {
4753 LDKStr err_str = obj->api_misuse_error.err;
4754 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4755 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
4757 case LDKAPIError_FeeRateTooHigh: {
4758 LDKStr err_str = obj->fee_rate_too_high.err;
4759 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4760 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
4762 case LDKAPIError_RouteError: {
4763 LDKStr err_str = obj->route_error.err;
4764 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4765 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
4767 case LDKAPIError_ChannelUnavailable: {
4768 LDKStr err_str = obj->channel_unavailable.err;
4769 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4770 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
4772 case LDKAPIError_MonitorUpdateFailed: {
4773 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
4775 case LDKAPIError_IncompatibleShutdownScript: {
4776 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4777 uintptr_t script_ref = 0;
4778 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4779 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4780 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4781 script_ref = (uintptr_t)script_var.inner & ~1;
4782 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
4787 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4788 CHECK(owner->result_ok);
4789 return *owner->contents.result;
4791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4792 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4793 CResult_NoneAPIErrorZ_get_ok(owner_conv);
4796 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4797 CHECK(!owner->result_ok);
4798 return APIError_clone(&*owner->contents.err);
4800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4801 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4802 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4803 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4804 uintptr_t ret_ref = (uintptr_t)ret_copy;
4808 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4809 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4810 for (size_t i = 0; i < ret.datalen; i++) {
4811 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4815 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4816 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4817 for (size_t i = 0; i < ret.datalen; i++) {
4818 ret.data[i] = APIError_clone(&orig->data[i]);
4822 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4823 CHECK(owner->result_ok);
4824 return ThirtyTwoBytes_clone(&*owner->contents.result);
4826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4827 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4828 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4829 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
4833 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4834 CHECK(!owner->result_ok);
4835 return APIError_clone(&*owner->contents.err);
4837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4838 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4839 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4840 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4841 uintptr_t ret_ref = (uintptr_t)ret_copy;
4845 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
4846 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
4847 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
4848 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
4849 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
4850 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
4851 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
4852 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
4853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
4854 LDKPaymentSendFailure_ParameterError_class =
4855 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
4856 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
4857 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
4858 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
4859 LDKPaymentSendFailure_PathParameterError_class =
4860 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
4861 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
4862 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
4863 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
4864 LDKPaymentSendFailure_AllFailedRetrySafe_class =
4865 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
4866 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
4867 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
4868 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
4869 LDKPaymentSendFailure_PartialFailure_class =
4870 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
4871 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
4872 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
4873 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
4875 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4876 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4878 case LDKPaymentSendFailure_ParameterError: {
4879 uintptr_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
4880 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
4882 case LDKPaymentSendFailure_PathParameterError: {
4883 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4884 int64_tArray path_parameter_error_arr = NULL;
4885 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
4886 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
4887 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4888 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4889 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4890 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4891 path_parameter_error_arr_ptr[w] = (uintptr_t)path_parameter_error_conv_22_conv;
4893 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
4894 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
4896 case LDKPaymentSendFailure_AllFailedRetrySafe: {
4897 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4898 int64_tArray all_failed_retry_safe_arr = NULL;
4899 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
4900 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
4901 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4902 uintptr_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
4903 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4905 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
4906 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
4908 case LDKPaymentSendFailure_PartialFailure: {
4909 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4910 int64_tArray results_arr = NULL;
4911 results_arr = (*env)->NewLongArray(env, results_var.datalen);
4912 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
4913 for (size_t w = 0; w < results_var.datalen; w++) {
4914 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4915 *results_conv_22_conv = results_var.data[w];
4916 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4917 results_arr_ptr[w] = (uintptr_t)results_conv_22_conv;
4919 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
4920 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4921 uintptr_t failed_paths_retry_ref = 0;
4922 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
4923 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4924 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4925 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4926 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
4928 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
4929 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
4930 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
4935 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4936 CHECK(owner->result_ok);
4937 return ThirtyTwoBytes_clone(&*owner->contents.result);
4939 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4940 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
4941 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4942 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
4946 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4947 CHECK(!owner->result_ok);
4948 return PaymentSendFailure_clone(&*owner->contents.err);
4950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4951 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
4952 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4953 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4954 uintptr_t ret_ref = (uintptr_t)ret_copy;
4958 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4959 CHECK(owner->result_ok);
4960 return *owner->contents.result;
4962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4963 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
4964 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4967 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4968 CHECK(!owner->result_ok);
4969 return PaymentSendFailure_clone(&*owner->contents.err);
4971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4972 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
4973 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4974 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4975 uintptr_t ret_ref = (uintptr_t)ret_copy;
4979 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4980 return ThirtyTwoBytes_clone(&owner->a);
4982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4983 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
4984 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4985 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
4989 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4990 return ThirtyTwoBytes_clone(&owner->b);
4992 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4993 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
4994 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4995 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
4999 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5000 CHECK(owner->result_ok);
5001 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5004 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5005 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5006 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5007 return ((uintptr_t)ret_conv);
5010 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5011 CHECK(!owner->result_ok);
5012 return PaymentSendFailure_clone(&*owner->contents.err);
5014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5015 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5016 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5017 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5018 uintptr_t ret_ref = (uintptr_t)ret_copy;
5022 static jclass LDKNetAddress_IPv4_class = NULL;
5023 static jmethodID LDKNetAddress_IPv4_meth = NULL;
5024 static jclass LDKNetAddress_IPv6_class = NULL;
5025 static jmethodID LDKNetAddress_IPv6_meth = NULL;
5026 static jclass LDKNetAddress_OnionV2_class = NULL;
5027 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
5028 static jclass LDKNetAddress_OnionV3_class = NULL;
5029 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
5030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
5031 LDKNetAddress_IPv4_class =
5032 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
5033 CHECK(LDKNetAddress_IPv4_class != NULL);
5034 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
5035 CHECK(LDKNetAddress_IPv4_meth != NULL);
5036 LDKNetAddress_IPv6_class =
5037 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
5038 CHECK(LDKNetAddress_IPv6_class != NULL);
5039 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
5040 CHECK(LDKNetAddress_IPv6_meth != NULL);
5041 LDKNetAddress_OnionV2_class =
5042 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
5043 CHECK(LDKNetAddress_OnionV2_class != NULL);
5044 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
5045 CHECK(LDKNetAddress_OnionV2_meth != NULL);
5046 LDKNetAddress_OnionV3_class =
5047 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
5048 CHECK(LDKNetAddress_OnionV3_class != NULL);
5049 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
5050 CHECK(LDKNetAddress_OnionV3_meth != NULL);
5052 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5053 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
5055 case LDKNetAddress_IPv4: {
5056 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
5057 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
5058 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
5060 case LDKNetAddress_IPv6: {
5061 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
5062 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
5063 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
5065 case LDKNetAddress_OnionV2: {
5066 int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
5067 (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
5068 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
5070 case LDKNetAddress_OnionV3: {
5071 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
5072 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
5073 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);
5078 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
5079 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
5080 for (size_t i = 0; i < ret.datalen; i++) {
5081 ret.data[i] = NetAddress_clone(&orig->data[i]);
5085 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5086 return ThirtyTwoBytes_clone(&owner->a);
5088 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5089 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5090 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5091 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
5095 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5096 return ThirtyTwoBytes_clone(&owner->b);
5098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5099 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5100 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5101 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
5105 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5106 CHECK(owner->result_ok);
5107 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5110 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5111 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5112 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5113 return ((uintptr_t)ret_conv);
5116 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5117 CHECK(!owner->result_ok);
5118 return *owner->contents.err;
5120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5121 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5122 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5125 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5126 CHECK(owner->result_ok);
5127 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5130 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5131 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5132 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5133 return ((uintptr_t)ret_conv);
5136 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5137 CHECK(!owner->result_ok);
5138 return APIError_clone(&*owner->contents.err);
5140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5141 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5142 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5143 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5144 uintptr_t ret_ref = (uintptr_t)ret_copy;
5148 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5149 CHECK(owner->result_ok);
5150 return ThirtyTwoBytes_clone(&*owner->contents.result);
5152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5153 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5154 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5155 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
5159 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5160 CHECK(!owner->result_ok);
5161 return *owner->contents.err;
5163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5164 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5165 CResult_PaymentSecretNoneZ_get_err(owner_conv);
5168 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5169 CHECK(owner->result_ok);
5170 return ThirtyTwoBytes_clone(&*owner->contents.result);
5172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5173 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5174 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5175 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
5179 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5180 CHECK(!owner->result_ok);
5181 return APIError_clone(&*owner->contents.err);
5183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5184 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5185 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5186 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5187 uintptr_t ret_ref = (uintptr_t)ret_copy;
5191 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5192 CHECK(owner->result_ok);
5193 return ThirtyTwoBytes_clone(&*owner->contents.result);
5195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5196 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5197 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5198 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
5202 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5203 CHECK(!owner->result_ok);
5204 return APIError_clone(&*owner->contents.err);
5206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5207 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5208 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5209 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5210 uintptr_t ret_ref = (uintptr_t)ret_copy;
5214 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5215 CHECK(owner->result_ok);
5216 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
5218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5219 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
5220 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5221 uintptr_t ret_ref = 0;
5222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5225 ret_ref = (uintptr_t)ret_var.inner;
5226 if (ret_var.is_owned) {
5232 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5233 CHECK(!owner->result_ok);
5234 return DecodeError_clone(&*owner->contents.err);
5236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5237 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
5238 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5239 uintptr_t ret_ref = 0;
5240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5243 ret_ref = (uintptr_t)ret_var.inner;
5244 if (ret_var.is_owned) {
5250 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5251 CHECK(owner->result_ok);
5252 return ChannelCounterparty_clone(&*owner->contents.result);
5254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5255 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
5256 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5257 uintptr_t ret_ref = 0;
5258 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5259 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5261 ret_ref = (uintptr_t)ret_var.inner;
5262 if (ret_var.is_owned) {
5268 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5269 CHECK(!owner->result_ok);
5270 return DecodeError_clone(&*owner->contents.err);
5272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5273 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
5274 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5275 uintptr_t ret_ref = 0;
5276 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5277 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5279 ret_ref = (uintptr_t)ret_var.inner;
5280 if (ret_var.is_owned) {
5286 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5287 CHECK(owner->result_ok);
5288 return ChannelDetails_clone(&*owner->contents.result);
5290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5291 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
5292 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5293 uintptr_t ret_ref = 0;
5294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5297 ret_ref = (uintptr_t)ret_var.inner;
5298 if (ret_var.is_owned) {
5304 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5305 CHECK(!owner->result_ok);
5306 return DecodeError_clone(&*owner->contents.err);
5308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5309 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
5310 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5311 uintptr_t ret_ref = 0;
5312 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5313 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5315 ret_ref = (uintptr_t)ret_var.inner;
5316 if (ret_var.is_owned) {
5322 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5323 CHECK(owner->result_ok);
5324 return PhantomRouteHints_clone(&*owner->contents.result);
5326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5327 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
5328 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5329 uintptr_t ret_ref = 0;
5330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5333 ret_ref = (uintptr_t)ret_var.inner;
5334 if (ret_var.is_owned) {
5340 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5341 CHECK(!owner->result_ok);
5342 return DecodeError_clone(&*owner->contents.err);
5344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5345 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
5346 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5347 uintptr_t ret_ref = 0;
5348 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5349 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5350 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5351 ret_ref = (uintptr_t)ret_var.inner;
5352 if (ret_var.is_owned) {
5358 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5359 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5360 for (size_t i = 0; i < ret.datalen; i++) {
5361 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5365 typedef struct LDKWatch_JCalls {
5366 atomic_size_t refcnt;
5369 jmethodID watch_channel_meth;
5370 jmethodID update_channel_meth;
5371 jmethodID release_pending_monitor_events_meth;
5373 static void LDKWatch_JCalls_free(void* this_arg) {
5374 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5375 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5377 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5378 if (get_jenv_res == JNI_EDETACHED) {
5379 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5381 DO_ASSERT(get_jenv_res == JNI_OK);
5383 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5384 if (get_jenv_res == JNI_EDETACHED) {
5385 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5390 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5391 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5393 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5394 if (get_jenv_res == JNI_EDETACHED) {
5395 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5397 DO_ASSERT(get_jenv_res == JNI_OK);
5399 LDKOutPoint funding_txo_var = funding_txo;
5400 uintptr_t funding_txo_ref = 0;
5401 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5402 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5403 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5404 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5405 if (funding_txo_var.is_owned) {
5406 funding_txo_ref |= 1;
5408 LDKChannelMonitor monitor_var = monitor;
5409 uintptr_t monitor_ref = 0;
5410 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5411 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5412 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5413 monitor_ref = (uintptr_t)monitor_var.inner;
5414 if (monitor_var.is_owned) {
5417 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5419 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
5420 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5421 (*env)->ExceptionDescribe(env);
5422 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
5424 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5425 CHECK_ACCESS(ret_ptr);
5426 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5428 if (get_jenv_res == JNI_EDETACHED) {
5429 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5433 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5434 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5436 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5437 if (get_jenv_res == JNI_EDETACHED) {
5438 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5440 DO_ASSERT(get_jenv_res == JNI_OK);
5442 LDKOutPoint funding_txo_var = funding_txo;
5443 uintptr_t funding_txo_ref = 0;
5444 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5445 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5446 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5447 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5448 if (funding_txo_var.is_owned) {
5449 funding_txo_ref |= 1;
5451 LDKChannelMonitorUpdate update_var = update;
5452 uintptr_t update_ref = 0;
5453 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5454 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5455 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5456 update_ref = (uintptr_t)update_var.inner;
5457 if (update_var.is_owned) {
5460 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5462 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
5463 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5464 (*env)->ExceptionDescribe(env);
5465 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
5467 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5468 CHECK_ACCESS(ret_ptr);
5469 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5471 if (get_jenv_res == JNI_EDETACHED) {
5472 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5476 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5477 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5479 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5480 if (get_jenv_res == JNI_EDETACHED) {
5481 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5483 DO_ASSERT(get_jenv_res == JNI_OK);
5485 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5487 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
5488 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5489 (*env)->ExceptionDescribe(env);
5490 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
5492 LDKCVec_MonitorEventZ ret_constr;
5493 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5494 if (ret_constr.datalen > 0)
5495 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5497 ret_constr.data = NULL;
5498 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5499 for (size_t o = 0; o < ret_constr.datalen; o++) {
5500 int64_t ret_conv_14 = ret_vals[o];
5501 void* ret_conv_14_ptr = (void*)(((uintptr_t)ret_conv_14) & ~1);
5502 CHECK_ACCESS(ret_conv_14_ptr);
5503 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
5504 FREE((void*)ret_conv_14);
5505 ret_constr.data[o] = ret_conv_14_conv;
5507 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5508 if (get_jenv_res == JNI_EDETACHED) {
5509 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5513 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5514 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5515 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5517 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
5518 jclass c = (*env)->GetObjectClass(env, o);
5520 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5521 atomic_init(&calls->refcnt, 1);
5522 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5523 calls->o = (*env)->NewWeakGlobalRef(env, o);
5524 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
5525 CHECK(calls->watch_channel_meth != NULL);
5526 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
5527 CHECK(calls->update_channel_meth != NULL);
5528 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
5529 CHECK(calls->release_pending_monitor_events_meth != NULL);
5532 .this_arg = (void*) calls,
5533 .watch_channel = watch_channel_LDKWatch_jcall,
5534 .update_channel = update_channel_LDKWatch_jcall,
5535 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5536 .free = LDKWatch_JCalls_free,
5540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
5541 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5542 *res_ptr = LDKWatch_init(env, clz, o);
5543 return (uint64_t)res_ptr;
5545 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) {
5546 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5547 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5548 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5549 LDKOutPoint funding_txo_conv;
5550 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5551 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5552 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5553 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5554 LDKChannelMonitor monitor_conv;
5555 monitor_conv.inner = (void*)(monitor & (~1));
5556 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5557 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5558 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5559 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5560 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5561 return (uintptr_t)ret_conv;
5564 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) {
5565 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5566 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5567 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5568 LDKOutPoint funding_txo_conv;
5569 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5570 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5571 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5572 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5573 LDKChannelMonitorUpdate update_conv;
5574 update_conv.inner = (void*)(update & (~1));
5575 update_conv.is_owned = (update & 1) || (update == 0);
5576 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5577 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5578 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5579 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5580 return (uintptr_t)ret_conv;
5583 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
5584 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5585 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5586 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5587 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5588 int64_tArray ret_arr = NULL;
5589 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5590 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5591 for (size_t o = 0; o < ret_var.datalen; o++) {
5592 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5593 *ret_conv_14_copy = ret_var.data[o];
5594 uintptr_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
5595 ret_arr_ptr[o] = ret_conv_14_ref;
5597 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5602 typedef struct LDKBroadcasterInterface_JCalls {
5603 atomic_size_t refcnt;
5606 jmethodID broadcast_transaction_meth;
5607 } LDKBroadcasterInterface_JCalls;
5608 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5609 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5610 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5612 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5613 if (get_jenv_res == JNI_EDETACHED) {
5614 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5616 DO_ASSERT(get_jenv_res == JNI_OK);
5618 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5619 if (get_jenv_res == JNI_EDETACHED) {
5620 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5625 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5626 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5628 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5629 if (get_jenv_res == JNI_EDETACHED) {
5630 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5632 DO_ASSERT(get_jenv_res == JNI_OK);
5634 LDKTransaction tx_var = tx;
5635 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
5636 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
5637 Transaction_free(tx_var);
5638 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5640 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
5641 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5642 (*env)->ExceptionDescribe(env);
5643 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
5645 if (get_jenv_res == JNI_EDETACHED) {
5646 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5649 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5650 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5651 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5653 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
5654 jclass c = (*env)->GetObjectClass(env, o);
5656 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5657 atomic_init(&calls->refcnt, 1);
5658 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5659 calls->o = (*env)->NewWeakGlobalRef(env, o);
5660 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
5661 CHECK(calls->broadcast_transaction_meth != NULL);
5663 LDKBroadcasterInterface ret = {
5664 .this_arg = (void*) calls,
5665 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5666 .free = LDKBroadcasterInterface_JCalls_free,
5670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
5671 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5672 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
5673 return (uint64_t)res_ptr;
5675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
5676 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5677 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5678 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5679 LDKTransaction tx_ref;
5680 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
5681 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5682 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
5683 tx_ref.data_is_owned = true;
5684 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5687 typedef struct LDKKeysInterface_JCalls {
5688 atomic_size_t refcnt;
5691 jmethodID get_node_secret_meth;
5692 jmethodID get_destination_script_meth;
5693 jmethodID get_shutdown_scriptpubkey_meth;
5694 jmethodID get_channel_signer_meth;
5695 jmethodID get_secure_random_bytes_meth;
5696 jmethodID read_chan_signer_meth;
5697 jmethodID sign_invoice_meth;
5698 jmethodID get_inbound_payment_key_material_meth;
5699 } LDKKeysInterface_JCalls;
5700 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5701 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5702 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5704 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5705 if (get_jenv_res == JNI_EDETACHED) {
5706 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5708 DO_ASSERT(get_jenv_res == JNI_OK);
5710 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5711 if (get_jenv_res == JNI_EDETACHED) {
5712 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5717 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5718 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5720 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5721 if (get_jenv_res == JNI_EDETACHED) {
5722 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5724 DO_ASSERT(get_jenv_res == JNI_OK);
5726 jclass recipient_conv = LDKRecipient_to_java(env, recipient);
5727 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5729 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
5730 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5731 (*env)->ExceptionDescribe(env);
5732 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
5734 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5735 CHECK_ACCESS(ret_ptr);
5736 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5738 if (get_jenv_res == JNI_EDETACHED) {
5739 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5743 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5744 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5746 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5747 if (get_jenv_res == JNI_EDETACHED) {
5748 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5750 DO_ASSERT(get_jenv_res == JNI_OK);
5752 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5754 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
5755 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5756 (*env)->ExceptionDescribe(env);
5757 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
5759 LDKCVec_u8Z ret_ref;
5760 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5761 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5762 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5763 if (get_jenv_res == JNI_EDETACHED) {
5764 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5768 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5769 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5771 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5772 if (get_jenv_res == JNI_EDETACHED) {
5773 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5775 DO_ASSERT(get_jenv_res == JNI_OK);
5777 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5779 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
5780 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5781 (*env)->ExceptionDescribe(env);
5782 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
5784 LDKShutdownScript ret_conv;
5785 ret_conv.inner = (void*)(ret & (~1));
5786 ret_conv.is_owned = (ret & 1) || (ret == 0);
5787 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5788 if (get_jenv_res == JNI_EDETACHED) {
5789 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5793 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5794 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5796 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5797 if (get_jenv_res == JNI_EDETACHED) {
5798 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5800 DO_ASSERT(get_jenv_res == JNI_OK);
5802 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5804 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
5805 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5806 (*env)->ExceptionDescribe(env);
5807 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
5809 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5810 CHECK_ACCESS(ret_ptr);
5811 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5813 if (get_jenv_res == JNI_EDETACHED) {
5814 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5818 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5819 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5821 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5822 if (get_jenv_res == JNI_EDETACHED) {
5823 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5825 DO_ASSERT(get_jenv_res == JNI_OK);
5827 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5829 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
5830 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5831 (*env)->ExceptionDescribe(env);
5832 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
5834 LDKThirtyTwoBytes ret_ref;
5835 CHECK((*env)->GetArrayLength(env, ret) == 32);
5836 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5837 if (get_jenv_res == JNI_EDETACHED) {
5838 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5842 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5843 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5845 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5846 if (get_jenv_res == JNI_EDETACHED) {
5847 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5849 DO_ASSERT(get_jenv_res == JNI_OK);
5851 LDKu8slice reader_var = reader;
5852 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
5853 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
5854 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5856 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
5857 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5858 (*env)->ExceptionDescribe(env);
5859 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
5861 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5862 CHECK_ACCESS(ret_ptr);
5863 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5865 if (get_jenv_res == JNI_EDETACHED) {
5866 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5870 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5871 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5873 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5874 if (get_jenv_res == JNI_EDETACHED) {
5875 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5877 DO_ASSERT(get_jenv_res == JNI_OK);
5879 LDKu8slice hrp_bytes_var = hrp_bytes;
5880 int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
5881 (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
5882 LDKCVec_u5Z invoice_data_var = invoice_data;
5883 jobjectArray invoice_data_arr = NULL;
5884 invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
5885 int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
5886 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5887 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5888 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5890 (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
5891 FREE(invoice_data_var.data);
5892 jclass receipient_conv = LDKRecipient_to_java(env, receipient);
5893 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5895 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
5896 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5897 (*env)->ExceptionDescribe(env);
5898 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
5900 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5901 CHECK_ACCESS(ret_ptr);
5902 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5904 if (get_jenv_res == JNI_EDETACHED) {
5905 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5909 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5910 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5912 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5913 if (get_jenv_res == JNI_EDETACHED) {
5914 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5916 DO_ASSERT(get_jenv_res == JNI_OK);
5918 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5920 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
5921 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5922 (*env)->ExceptionDescribe(env);
5923 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
5925 LDKThirtyTwoBytes ret_ref;
5926 CHECK((*env)->GetArrayLength(env, ret) == 32);
5927 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5928 if (get_jenv_res == JNI_EDETACHED) {
5929 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5933 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5934 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5935 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5937 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
5938 jclass c = (*env)->GetObjectClass(env, o);
5940 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5941 atomic_init(&calls->refcnt, 1);
5942 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5943 calls->o = (*env)->NewWeakGlobalRef(env, o);
5944 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
5945 CHECK(calls->get_node_secret_meth != NULL);
5946 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
5947 CHECK(calls->get_destination_script_meth != NULL);
5948 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
5949 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
5950 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
5951 CHECK(calls->get_channel_signer_meth != NULL);
5952 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
5953 CHECK(calls->get_secure_random_bytes_meth != NULL);
5954 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
5955 CHECK(calls->read_chan_signer_meth != NULL);
5956 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
5957 CHECK(calls->sign_invoice_meth != NULL);
5958 calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
5959 CHECK(calls->get_inbound_payment_key_material_meth != NULL);
5961 LDKKeysInterface ret = {
5962 .this_arg = (void*) calls,
5963 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5964 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5965 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5966 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5967 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5968 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5969 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5970 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5971 .free = LDKKeysInterface_JCalls_free,
5975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
5976 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5977 *res_ptr = LDKKeysInterface_init(env, clz, o);
5978 return (uint64_t)res_ptr;
5980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
5981 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5982 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5983 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5984 LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
5985 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5986 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5987 return (uintptr_t)ret_conv;
5990 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
5991 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5992 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5993 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5994 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5995 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5996 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5997 CVec_u8Z_free(ret_var);
6001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
6002 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6003 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6004 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6005 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6006 uintptr_t ret_ref = 0;
6007 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6008 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6010 ret_ref = (uintptr_t)ret_var.inner;
6011 if (ret_var.is_owned) {
6017 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) {
6018 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6019 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6020 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6021 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6022 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6023 return (uintptr_t)ret_ret;
6026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
6027 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6028 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6029 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6030 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6031 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
6035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
6036 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6037 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6038 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6039 LDKu8slice reader_ref;
6040 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
6041 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
6042 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6043 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6044 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
6045 return (uintptr_t)ret_conv;
6048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray hrp_bytes, jobjectArray invoice_data, jclass receipient) {
6049 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6050 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6051 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6052 LDKu8slice hrp_bytes_ref;
6053 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
6054 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
6055 LDKCVec_u5Z invoice_data_constr;
6056 invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
6057 if (invoice_data_constr.datalen > 0)
6058 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
6060 invoice_data_constr.data = NULL;
6061 int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
6062 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6063 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6065 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
6067 (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
6068 LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
6069 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6070 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
6071 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
6072 return (uintptr_t)ret_conv;
6075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
6076 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6077 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6078 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6079 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6080 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
6084 typedef struct LDKFeeEstimator_JCalls {
6085 atomic_size_t refcnt;
6088 jmethodID get_est_sat_per_1000_weight_meth;
6089 } LDKFeeEstimator_JCalls;
6090 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6091 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6092 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6094 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6095 if (get_jenv_res == JNI_EDETACHED) {
6096 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6098 DO_ASSERT(get_jenv_res == JNI_OK);
6100 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6101 if (get_jenv_res == JNI_EDETACHED) {
6102 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6107 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6108 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6110 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6111 if (get_jenv_res == JNI_EDETACHED) {
6112 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6114 DO_ASSERT(get_jenv_res == JNI_OK);
6116 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
6117 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6119 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
6120 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6121 (*env)->ExceptionDescribe(env);
6122 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
6124 if (get_jenv_res == JNI_EDETACHED) {
6125 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6129 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6130 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6131 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6133 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
6134 jclass c = (*env)->GetObjectClass(env, o);
6136 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6137 atomic_init(&calls->refcnt, 1);
6138 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6139 calls->o = (*env)->NewWeakGlobalRef(env, o);
6140 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
6141 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
6143 LDKFeeEstimator ret = {
6144 .this_arg = (void*) calls,
6145 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6146 .free = LDKFeeEstimator_JCalls_free,
6150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
6151 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6152 *res_ptr = LDKFeeEstimator_init(env, clz, o);
6153 return (uint64_t)res_ptr;
6155 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) {
6156 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6157 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6158 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6159 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
6160 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6164 typedef struct LDKLogger_JCalls {
6165 atomic_size_t refcnt;
6170 static void LDKLogger_JCalls_free(void* this_arg) {
6171 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6172 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6174 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6175 if (get_jenv_res == JNI_EDETACHED) {
6176 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6178 DO_ASSERT(get_jenv_res == JNI_OK);
6180 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6181 if (get_jenv_res == JNI_EDETACHED) {
6182 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6187 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
6188 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6190 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6191 if (get_jenv_res == JNI_EDETACHED) {
6192 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6194 DO_ASSERT(get_jenv_res == JNI_OK);
6196 LDKRecord record_var = *record;
6197 uintptr_t record_ref = 0;
6198 record_var = Record_clone(record);
6199 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6200 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6201 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
6202 record_ref = (uintptr_t)record_var.inner;
6203 if (record_var.is_owned) {
6206 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6208 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
6209 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6210 (*env)->ExceptionDescribe(env);
6211 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
6213 if (get_jenv_res == JNI_EDETACHED) {
6214 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6217 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
6218 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
6219 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6221 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
6222 jclass c = (*env)->GetObjectClass(env, o);
6224 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
6225 atomic_init(&calls->refcnt, 1);
6226 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6227 calls->o = (*env)->NewWeakGlobalRef(env, o);
6228 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
6229 CHECK(calls->log_meth != NULL);
6232 .this_arg = (void*) calls,
6233 .log = log_LDKLogger_jcall,
6234 .free = LDKLogger_JCalls_free,
6238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
6239 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
6240 *res_ptr = LDKLogger_init(env, clz, o);
6241 return (uint64_t)res_ptr;
6243 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6244 return ThirtyTwoBytes_clone(&owner->a);
6246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6247 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6248 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6249 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
6253 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6257 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6258 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6259 uintptr_t ret_ref = 0;
6260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6263 ret_ref = (uintptr_t)ret_var.inner & ~1;
6267 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6268 CHECK(owner->result_ok);
6269 return &*owner->contents.result;
6271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6272 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6273 uintptr_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
6277 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6278 CHECK(!owner->result_ok);
6279 return DecodeError_clone(&*owner->contents.err);
6281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6282 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6283 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6284 uintptr_t ret_ref = 0;
6285 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6286 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6288 ret_ref = (uintptr_t)ret_var.inner;
6289 if (ret_var.is_owned) {
6295 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6296 CHECK(owner->result_ok);
6297 return ChannelConfig_clone(&*owner->contents.result);
6299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6300 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
6301 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6302 uintptr_t ret_ref = 0;
6303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6306 ret_ref = (uintptr_t)ret_var.inner;
6307 if (ret_var.is_owned) {
6313 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6314 CHECK(!owner->result_ok);
6315 return DecodeError_clone(&*owner->contents.err);
6317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6318 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
6319 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6320 uintptr_t ret_ref = 0;
6321 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6322 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6324 ret_ref = (uintptr_t)ret_var.inner;
6325 if (ret_var.is_owned) {
6331 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6332 CHECK(owner->result_ok);
6333 return OutPoint_clone(&*owner->contents.result);
6335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6336 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
6337 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6338 uintptr_t ret_ref = 0;
6339 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6340 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6342 ret_ref = (uintptr_t)ret_var.inner;
6343 if (ret_var.is_owned) {
6349 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6350 CHECK(!owner->result_ok);
6351 return DecodeError_clone(&*owner->contents.err);
6353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6354 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
6355 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6356 uintptr_t ret_ref = 0;
6357 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6358 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6359 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6360 ret_ref = (uintptr_t)ret_var.inner;
6361 if (ret_var.is_owned) {
6367 typedef struct LDKType_JCalls {
6368 atomic_size_t refcnt;
6371 jmethodID type_id_meth;
6372 jmethodID debug_str_meth;
6373 jmethodID write_meth;
6375 static void LDKType_JCalls_free(void* this_arg) {
6376 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6377 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6379 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6380 if (get_jenv_res == JNI_EDETACHED) {
6381 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6383 DO_ASSERT(get_jenv_res == JNI_OK);
6385 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6386 if (get_jenv_res == JNI_EDETACHED) {
6387 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6392 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6393 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6395 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6396 if (get_jenv_res == JNI_EDETACHED) {
6397 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6399 DO_ASSERT(get_jenv_res == JNI_OK);
6401 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6403 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
6404 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6405 (*env)->ExceptionDescribe(env);
6406 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
6408 if (get_jenv_res == JNI_EDETACHED) {
6409 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6413 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6414 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6416 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6417 if (get_jenv_res == JNI_EDETACHED) {
6418 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6420 DO_ASSERT(get_jenv_res == JNI_OK);
6422 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6424 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
6425 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6426 (*env)->ExceptionDescribe(env);
6427 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
6429 LDKStr ret_conv = java_to_owned_str(env, ret);
6430 if (get_jenv_res == JNI_EDETACHED) {
6431 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6435 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6436 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6438 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6439 if (get_jenv_res == JNI_EDETACHED) {
6440 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6442 DO_ASSERT(get_jenv_res == JNI_OK);
6444 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6446 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
6447 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6448 (*env)->ExceptionDescribe(env);
6449 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
6451 LDKCVec_u8Z ret_ref;
6452 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6453 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6454 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6455 if (get_jenv_res == JNI_EDETACHED) {
6456 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6460 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6461 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6462 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6464 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
6465 jclass c = (*env)->GetObjectClass(env, o);
6467 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6468 atomic_init(&calls->refcnt, 1);
6469 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6470 calls->o = (*env)->NewWeakGlobalRef(env, o);
6471 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
6472 CHECK(calls->type_id_meth != NULL);
6473 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
6474 CHECK(calls->debug_str_meth != NULL);
6475 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
6476 CHECK(calls->write_meth != NULL);
6479 .this_arg = (void*) calls,
6480 .type_id = type_id_LDKType_jcall,
6481 .debug_str = debug_str_LDKType_jcall,
6482 .write = write_LDKType_jcall,
6483 .cloned = LDKType_JCalls_cloned,
6484 .free = LDKType_JCalls_free,
6488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
6489 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6490 *res_ptr = LDKType_init(env, clz, o);
6491 return (uint64_t)res_ptr;
6493 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
6494 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6495 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6496 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6497 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6501 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
6502 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6503 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6504 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6505 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6506 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
6511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
6512 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6513 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6514 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6515 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6516 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6517 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6518 CVec_u8Z_free(ret_var);
6522 static jclass LDKCOption_TypeZ_Some_class = NULL;
6523 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
6524 static jclass LDKCOption_TypeZ_None_class = NULL;
6525 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
6526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
6527 LDKCOption_TypeZ_Some_class =
6528 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
6529 CHECK(LDKCOption_TypeZ_Some_class != NULL);
6530 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
6531 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
6532 LDKCOption_TypeZ_None_class =
6533 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
6534 CHECK(LDKCOption_TypeZ_None_class != NULL);
6535 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
6536 CHECK(LDKCOption_TypeZ_None_meth != NULL);
6538 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6539 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
6541 case LDKCOption_TypeZ_Some: {
6542 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6543 *some_ret = Type_clone(&obj->some);
6544 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uintptr_t)some_ret);
6546 case LDKCOption_TypeZ_None: {
6547 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
6552 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6553 CHECK(owner->result_ok);
6554 return COption_TypeZ_clone(&*owner->contents.result);
6556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6557 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6558 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6559 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6560 uintptr_t ret_ref = (uintptr_t)ret_copy;
6564 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6565 CHECK(!owner->result_ok);
6566 return DecodeError_clone(&*owner->contents.err);
6568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6569 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6570 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6571 uintptr_t ret_ref = 0;
6572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6575 ret_ref = (uintptr_t)ret_var.inner;
6576 if (ret_var.is_owned) {
6582 static jclass LDKPaymentError_Invoice_class = NULL;
6583 static jmethodID LDKPaymentError_Invoice_meth = NULL;
6584 static jclass LDKPaymentError_Routing_class = NULL;
6585 static jmethodID LDKPaymentError_Routing_meth = NULL;
6586 static jclass LDKPaymentError_Sending_class = NULL;
6587 static jmethodID LDKPaymentError_Sending_meth = NULL;
6588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
6589 LDKPaymentError_Invoice_class =
6590 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
6591 CHECK(LDKPaymentError_Invoice_class != NULL);
6592 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
6593 CHECK(LDKPaymentError_Invoice_meth != NULL);
6594 LDKPaymentError_Routing_class =
6595 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
6596 CHECK(LDKPaymentError_Routing_class != NULL);
6597 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
6598 CHECK(LDKPaymentError_Routing_meth != NULL);
6599 LDKPaymentError_Sending_class =
6600 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
6601 CHECK(LDKPaymentError_Sending_class != NULL);
6602 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
6603 CHECK(LDKPaymentError_Sending_meth != NULL);
6605 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6606 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
6608 case LDKPaymentError_Invoice: {
6609 LDKStr invoice_str = obj->invoice;
6610 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
6611 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
6613 case LDKPaymentError_Routing: {
6614 LDKLightningError routing_var = obj->routing;
6615 uintptr_t routing_ref = 0;
6616 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6617 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6618 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
6619 routing_ref = (uintptr_t)routing_var.inner & ~1;
6620 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
6622 case LDKPaymentError_Sending: {
6623 uintptr_t sending_ref = ((uintptr_t)&obj->sending) | 1;
6624 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
6629 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6630 CHECK(owner->result_ok);
6631 return ThirtyTwoBytes_clone(&*owner->contents.result);
6633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6634 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6635 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6636 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
6640 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6641 CHECK(!owner->result_ok);
6642 return PaymentError_clone(&*owner->contents.err);
6644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6645 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6646 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6647 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
6648 uintptr_t ret_ref = (uintptr_t)ret_copy;
6652 static inline enum LDKSiPrefix CResult_SiPrefixNoneZ_get_ok(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){
6653 CHECK(owner->result_ok);
6654 return SiPrefix_clone(&*owner->contents.result);
6656 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6657 LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1);
6658 jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixNoneZ_get_ok(owner_conv));
6662 static inline void CResult_SiPrefixNoneZ_get_err(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){
6663 CHECK(!owner->result_ok);
6664 return *owner->contents.err;
6666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6667 LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1);
6668 CResult_SiPrefixNoneZ_get_err(owner_conv);
6671 static inline struct LDKInvoice CResult_InvoiceNoneZ_get_ok(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){
6672 CHECK(owner->result_ok);
6673 return Invoice_clone(&*owner->contents.result);
6675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6676 LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1);
6677 LDKInvoice ret_var = CResult_InvoiceNoneZ_get_ok(owner_conv);
6678 uintptr_t ret_ref = 0;
6679 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6680 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6682 ret_ref = (uintptr_t)ret_var.inner;
6683 if (ret_var.is_owned) {
6689 static inline void CResult_InvoiceNoneZ_get_err(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){
6690 CHECK(!owner->result_ok);
6691 return *owner->contents.err;
6693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6694 LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1);
6695 CResult_InvoiceNoneZ_get_err(owner_conv);
6698 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceNoneZ_get_ok(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){
6699 CHECK(owner->result_ok);
6700 return SignedRawInvoice_clone(&*owner->contents.result);
6702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6703 LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1);
6704 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceNoneZ_get_ok(owner_conv);
6705 uintptr_t ret_ref = 0;
6706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6709 ret_ref = (uintptr_t)ret_var.inner;
6710 if (ret_var.is_owned) {
6716 static inline void CResult_SignedRawInvoiceNoneZ_get_err(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){
6717 CHECK(!owner->result_ok);
6718 return *owner->contents.err;
6720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6721 LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1);
6722 CResult_SignedRawInvoiceNoneZ_get_err(owner_conv);
6725 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6726 return RawInvoice_clone(&owner->a);
6728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6729 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6730 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
6731 uintptr_t ret_ref = 0;
6732 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6733 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6735 ret_ref = (uintptr_t)ret_var.inner;
6736 if (ret_var.is_owned) {
6742 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6743 return ThirtyTwoBytes_clone(&owner->b);
6745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6746 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6747 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6748 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
6752 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6753 return InvoiceSignature_clone(&owner->c);
6755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
6756 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6757 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
6758 uintptr_t ret_ref = 0;
6759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6762 ret_ref = (uintptr_t)ret_var.inner;
6763 if (ret_var.is_owned) {
6769 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6770 CHECK(owner->result_ok);
6771 return PayeePubKey_clone(&*owner->contents.result);
6773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6774 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6775 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
6776 uintptr_t ret_ref = 0;
6777 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6778 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6779 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6780 ret_ref = (uintptr_t)ret_var.inner;
6781 if (ret_var.is_owned) {
6787 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6788 CHECK(!owner->result_ok);
6789 return *owner->contents.err;
6791 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6792 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6793 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
6797 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
6798 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
6799 for (size_t i = 0; i < ret.datalen; i++) {
6800 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
6804 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6805 CHECK(owner->result_ok);
6806 return PositiveTimestamp_clone(&*owner->contents.result);
6808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6809 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6810 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6811 uintptr_t ret_ref = 0;
6812 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6813 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6815 ret_ref = (uintptr_t)ret_var.inner;
6816 if (ret_var.is_owned) {
6822 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6823 CHECK(!owner->result_ok);
6824 return CreationError_clone(&*owner->contents.err);
6826 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6827 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6828 jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6832 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6833 CHECK(owner->result_ok);
6834 return *owner->contents.result;
6836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6837 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6838 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6841 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6842 CHECK(!owner->result_ok);
6843 return SemanticError_clone(&*owner->contents.err);
6845 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6846 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6847 jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
6851 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6852 CHECK(owner->result_ok);
6853 return Invoice_clone(&*owner->contents.result);
6855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6856 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6857 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6858 uintptr_t ret_ref = 0;
6859 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6860 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6862 ret_ref = (uintptr_t)ret_var.inner;
6863 if (ret_var.is_owned) {
6869 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6870 CHECK(!owner->result_ok);
6871 return SemanticError_clone(&*owner->contents.err);
6873 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6874 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6875 jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6879 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6880 CHECK(owner->result_ok);
6881 return Description_clone(&*owner->contents.result);
6883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6884 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6885 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6886 uintptr_t ret_ref = 0;
6887 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6888 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6890 ret_ref = (uintptr_t)ret_var.inner;
6891 if (ret_var.is_owned) {
6897 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6898 CHECK(!owner->result_ok);
6899 return CreationError_clone(&*owner->contents.err);
6901 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6902 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6903 jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6907 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6908 CHECK(owner->result_ok);
6909 return PrivateRoute_clone(&*owner->contents.result);
6911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6912 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6913 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6914 uintptr_t ret_ref = 0;
6915 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6916 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6917 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6918 ret_ref = (uintptr_t)ret_var.inner;
6919 if (ret_var.is_owned) {
6925 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6926 CHECK(!owner->result_ok);
6927 return CreationError_clone(&*owner->contents.err);
6929 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6930 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6931 jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6935 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6936 CHECK(owner->result_ok);
6937 return *owner->contents.result;
6939 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6940 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6941 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6942 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
6946 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6947 CHECK(!owner->result_ok);
6948 return *owner->contents.err;
6950 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6951 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6952 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
6956 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6957 CHECK(owner->result_ok);
6958 return ChannelMonitorUpdate_clone(&*owner->contents.result);
6960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6961 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6962 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6963 uintptr_t ret_ref = 0;
6964 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6965 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6967 ret_ref = (uintptr_t)ret_var.inner;
6968 if (ret_var.is_owned) {
6974 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6975 CHECK(!owner->result_ok);
6976 return DecodeError_clone(&*owner->contents.err);
6978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6979 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6980 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6981 uintptr_t ret_ref = 0;
6982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6985 ret_ref = (uintptr_t)ret_var.inner;
6986 if (ret_var.is_owned) {
6992 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
6993 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
6994 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
6995 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
6996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
6997 LDKCOption_MonitorEventZ_Some_class =
6998 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
6999 CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
7000 LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
7001 CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
7002 LDKCOption_MonitorEventZ_None_class =
7003 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
7004 CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
7005 LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
7006 CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
7008 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7009 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
7011 case LDKCOption_MonitorEventZ_Some: {
7012 uintptr_t some_ref = ((uintptr_t)&obj->some) | 1;
7013 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
7015 case LDKCOption_MonitorEventZ_None: {
7016 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
7021 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7022 CHECK(owner->result_ok);
7023 return COption_MonitorEventZ_clone(&*owner->contents.result);
7025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7026 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
7027 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7028 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7029 uintptr_t ret_ref = (uintptr_t)ret_copy;
7033 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7034 CHECK(!owner->result_ok);
7035 return DecodeError_clone(&*owner->contents.err);
7037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7038 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
7039 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7040 uintptr_t ret_ref = 0;
7041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7044 ret_ref = (uintptr_t)ret_var.inner;
7045 if (ret_var.is_owned) {
7051 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7052 CHECK(owner->result_ok);
7053 return HTLCUpdate_clone(&*owner->contents.result);
7055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7056 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
7057 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7058 uintptr_t ret_ref = 0;
7059 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7060 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7062 ret_ref = (uintptr_t)ret_var.inner;
7063 if (ret_var.is_owned) {
7069 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7070 CHECK(!owner->result_ok);
7071 return DecodeError_clone(&*owner->contents.err);
7073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7074 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
7075 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7076 uintptr_t ret_ref = 0;
7077 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7078 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7080 ret_ref = (uintptr_t)ret_var.inner;
7081 if (ret_var.is_owned) {
7087 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7088 return OutPoint_clone(&owner->a);
7090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7091 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
7092 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
7093 uintptr_t ret_ref = 0;
7094 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7095 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7097 ret_ref = (uintptr_t)ret_var.inner;
7098 if (ret_var.is_owned) {
7104 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7105 return CVec_u8Z_clone(&owner->b);
7107 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7108 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
7109 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
7110 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7111 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7112 CVec_u8Z_free(ret_var);
7116 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7119 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7120 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
7121 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(owner_conv);
7125 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7126 return CVec_u8Z_clone(&owner->b);
7128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7129 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
7130 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
7131 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7132 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7133 CVec_u8Z_free(ret_var);
7137 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
7138 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
7139 for (size_t i = 0; i < ret.datalen; i++) {
7140 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
7144 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7145 return ThirtyTwoBytes_clone(&owner->a);
7147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7148 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
7149 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7150 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
7154 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7155 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
7157 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7158 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
7159 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
7160 int64_tArray ret_arr = NULL;
7161 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7162 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7163 for (size_t v = 0; v < ret_var.datalen; v++) {
7164 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7165 *ret_conv_21_conv = ret_var.data[v];
7166 ret_arr_ptr[v] = ((uintptr_t)ret_conv_21_conv);
7168 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7173 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
7174 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 };
7175 for (size_t i = 0; i < ret.datalen; i++) {
7176 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
7180 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
7181 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
7182 for (size_t i = 0; i < ret.datalen; i++) {
7183 ret.data[i] = Event_clone(&orig->data[i]);
7187 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7190 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7191 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
7192 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(owner_conv);
7196 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7197 return TxOut_clone(&owner->b);
7199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7200 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
7201 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7202 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7203 return (uintptr_t)ret_ref;
7206 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7207 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7208 for (size_t i = 0; i < ret.datalen; i++) {
7209 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7213 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7214 return ThirtyTwoBytes_clone(&owner->a);
7216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7217 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
7218 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7219 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
7223 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7224 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7226 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7227 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
7228 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7229 int64_tArray ret_arr = NULL;
7230 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7231 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7232 for (size_t u = 0; u < ret_var.datalen; u++) {
7233 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7234 *ret_conv_20_conv = ret_var.data[u];
7235 ret_arr_ptr[u] = ((uintptr_t)ret_conv_20_conv);
7237 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7242 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
7243 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 };
7244 for (size_t i = 0; i < ret.datalen; i++) {
7245 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7249 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
7250 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
7251 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
7252 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
7253 static jclass LDKBalance_ContentiousClaimable_class = NULL;
7254 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
7255 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
7256 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
7257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
7258 LDKBalance_ClaimableOnChannelClose_class =
7259 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
7260 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
7261 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
7262 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
7263 LDKBalance_ClaimableAwaitingConfirmations_class =
7264 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
7265 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
7266 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
7267 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
7268 LDKBalance_ContentiousClaimable_class =
7269 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
7270 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
7271 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
7272 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
7273 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
7274 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
7275 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
7276 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
7277 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
7279 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7280 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
7282 case LDKBalance_ClaimableOnChannelClose: {
7283 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
7285 case LDKBalance_ClaimableAwaitingConfirmations: {
7286 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
7288 case LDKBalance_ContentiousClaimable: {
7289 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
7291 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
7292 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);
7297 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7298 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7299 for (size_t i = 0; i < ret.datalen; i++) {
7300 ret.data[i] = Balance_clone(&orig->data[i]);
7304 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7305 CHECK(owner->result_ok);
7306 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
7308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7309 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
7310 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7311 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7312 return ((uintptr_t)ret_conv);
7315 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7316 CHECK(!owner->result_ok);
7317 return DecodeError_clone(&*owner->contents.err);
7319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7320 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
7321 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7322 uintptr_t ret_ref = 0;
7323 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7324 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7325 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7326 ret_ref = (uintptr_t)ret_var.inner;
7327 if (ret_var.is_owned) {
7333 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
7334 CHECK(owner->result_ok);
7335 return *owner->contents.result;
7337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7338 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
7339 CResult_NoneLightningErrorZ_get_ok(owner_conv);
7342 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
7343 CHECK(!owner->result_ok);
7344 return LightningError_clone(&*owner->contents.err);
7346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7347 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
7348 LDKLightningError ret_var = CResult_NoneLightningErrorZ_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 LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7364 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
7365 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7366 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
7370 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7371 return Type_clone(&owner->b);
7373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7374 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
7375 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
7376 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
7377 return (uintptr_t)ret_ret;
7380 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
7381 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
7382 for (size_t i = 0; i < ret.datalen; i++) {
7383 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
7387 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
7388 CHECK(owner->result_ok);
7389 return *owner->contents.result;
7391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7392 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
7393 jboolean ret_val = CResult_boolLightningErrorZ_get_ok(owner_conv);
7397 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
7398 CHECK(!owner->result_ok);
7399 return LightningError_clone(&*owner->contents.err);
7401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7402 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
7403 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
7404 uintptr_t ret_ref = 0;
7405 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7406 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7408 ret_ref = (uintptr_t)ret_var.inner;
7409 if (ret_var.is_owned) {
7415 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7416 return ChannelAnnouncement_clone(&owner->a);
7418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7419 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7420 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(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 LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7433 return ChannelUpdate_clone(&owner->b);
7435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7436 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7437 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
7438 uintptr_t ret_ref = 0;
7439 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7440 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7442 ret_ref = (uintptr_t)ret_var.inner;
7443 if (ret_var.is_owned) {
7449 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7450 return ChannelUpdate_clone(&owner->c);
7452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7453 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7454 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
7455 uintptr_t ret_ref = 0;
7456 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7457 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7459 ret_ref = (uintptr_t)ret_var.inner;
7460 if (ret_var.is_owned) {
7466 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
7467 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
7468 for (size_t i = 0; i < ret.datalen; i++) {
7469 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
7473 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
7474 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
7475 for (size_t i = 0; i < ret.datalen; i++) {
7476 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
7480 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7481 CHECK(owner->result_ok);
7482 return CVec_u8Z_clone(&*owner->contents.result);
7484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7485 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
7486 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7487 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7488 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7489 CVec_u8Z_free(ret_var);
7493 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7494 CHECK(!owner->result_ok);
7495 return PeerHandleError_clone(&*owner->contents.err);
7497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7498 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
7499 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7500 uintptr_t ret_ref = 0;
7501 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7502 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7503 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7504 ret_ref = (uintptr_t)ret_var.inner;
7505 if (ret_var.is_owned) {
7511 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7512 CHECK(owner->result_ok);
7513 return *owner->contents.result;
7515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7516 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
7517 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7520 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7521 CHECK(!owner->result_ok);
7522 return PeerHandleError_clone(&*owner->contents.err);
7524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7525 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
7526 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7527 uintptr_t ret_ref = 0;
7528 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7529 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7530 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7531 ret_ref = (uintptr_t)ret_var.inner;
7532 if (ret_var.is_owned) {
7538 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7539 CHECK(owner->result_ok);
7540 return *owner->contents.result;
7542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7543 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
7544 jboolean ret_val = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7548 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7549 CHECK(!owner->result_ok);
7550 return PeerHandleError_clone(&*owner->contents.err);
7552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7553 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
7554 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7555 uintptr_t ret_ref = 0;
7556 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7557 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7558 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7559 ret_ref = (uintptr_t)ret_var.inner;
7560 if (ret_var.is_owned) {
7566 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
7567 CHECK(owner->result_ok);
7568 return NodeId_clone(&*owner->contents.result);
7570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7571 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
7572 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
7573 uintptr_t ret_ref = 0;
7574 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7575 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7577 ret_ref = (uintptr_t)ret_var.inner;
7578 if (ret_var.is_owned) {
7584 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
7585 CHECK(!owner->result_ok);
7586 return DecodeError_clone(&*owner->contents.err);
7588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7589 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
7590 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
7591 uintptr_t ret_ref = 0;
7592 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7593 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7594 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7595 ret_ref = (uintptr_t)ret_var.inner;
7596 if (ret_var.is_owned) {
7602 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
7603 CHECK(owner->result_ok);
7604 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
7606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7607 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
7608 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
7609 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
7610 uintptr_t ret_ref = (uintptr_t)ret_copy;
7614 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
7615 CHECK(!owner->result_ok);
7616 return DecodeError_clone(&*owner->contents.err);
7618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7619 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
7620 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
7621 uintptr_t ret_ref = 0;
7622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7625 ret_ref = (uintptr_t)ret_var.inner;
7626 if (ret_var.is_owned) {
7632 typedef struct LDKAccess_JCalls {
7633 atomic_size_t refcnt;
7636 jmethodID get_utxo_meth;
7638 static void LDKAccess_JCalls_free(void* this_arg) {
7639 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
7640 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7642 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7643 if (get_jenv_res == JNI_EDETACHED) {
7644 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7646 DO_ASSERT(get_jenv_res == JNI_OK);
7648 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7649 if (get_jenv_res == JNI_EDETACHED) {
7650 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7655 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
7656 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
7658 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7659 if (get_jenv_res == JNI_EDETACHED) {
7660 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7662 DO_ASSERT(get_jenv_res == JNI_OK);
7664 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
7665 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
7666 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7668 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
7669 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7670 (*env)->ExceptionDescribe(env);
7671 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
7673 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
7674 CHECK_ACCESS(ret_ptr);
7675 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
7677 if (get_jenv_res == JNI_EDETACHED) {
7678 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7682 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
7683 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
7684 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7686 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
7687 jclass c = (*env)->GetObjectClass(env, o);
7689 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
7690 atomic_init(&calls->refcnt, 1);
7691 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7692 calls->o = (*env)->NewWeakGlobalRef(env, o);
7693 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
7694 CHECK(calls->get_utxo_meth != NULL);
7697 .this_arg = (void*) calls,
7698 .get_utxo = get_utxo_LDKAccess_jcall,
7699 .free = LDKAccess_JCalls_free,
7703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
7704 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
7705 *res_ptr = LDKAccess_init(env, clz, o);
7706 return (uint64_t)res_ptr;
7708 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) {
7709 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7710 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7711 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
7712 unsigned char genesis_hash_arr[32];
7713 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
7714 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
7715 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
7716 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7717 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
7718 return (uintptr_t)ret_conv;
7721 static jclass LDKCOption_AccessZ_Some_class = NULL;
7722 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
7723 static jclass LDKCOption_AccessZ_None_class = NULL;
7724 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
7725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
7726 LDKCOption_AccessZ_Some_class =
7727 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
7728 CHECK(LDKCOption_AccessZ_Some_class != NULL);
7729 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
7730 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
7731 LDKCOption_AccessZ_None_class =
7732 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
7733 CHECK(LDKCOption_AccessZ_None_class != NULL);
7734 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
7735 CHECK(LDKCOption_AccessZ_None_meth != NULL);
7737 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7738 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
7740 case LDKCOption_AccessZ_Some: {
7741 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
7742 *some_ret = obj->some;
7743 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
7744 if ((*some_ret).free == LDKAccess_JCalls_free) {
7745 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7746 LDKAccess_JCalls_cloned(&(*some_ret));
7748 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uintptr_t)some_ret);
7750 case LDKCOption_AccessZ_None: {
7751 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
7756 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
7757 CHECK(owner->result_ok);
7758 return ChannelUpdateInfo_clone(&*owner->contents.result);
7760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7761 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
7762 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
7763 uintptr_t ret_ref = 0;
7764 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7765 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7767 ret_ref = (uintptr_t)ret_var.inner;
7768 if (ret_var.is_owned) {
7774 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
7775 CHECK(!owner->result_ok);
7776 return DecodeError_clone(&*owner->contents.err);
7778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7779 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
7780 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
7781 uintptr_t ret_ref = 0;
7782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7785 ret_ref = (uintptr_t)ret_var.inner;
7786 if (ret_var.is_owned) {
7792 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7793 CHECK(owner->result_ok);
7794 return ChannelInfo_clone(&*owner->contents.result);
7796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7797 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
7798 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
7799 uintptr_t ret_ref = 0;
7800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7803 ret_ref = (uintptr_t)ret_var.inner;
7804 if (ret_var.is_owned) {
7810 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7811 CHECK(!owner->result_ok);
7812 return DecodeError_clone(&*owner->contents.err);
7814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7815 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
7816 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
7817 uintptr_t ret_ref = 0;
7818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7821 ret_ref = (uintptr_t)ret_var.inner;
7822 if (ret_var.is_owned) {
7828 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7829 CHECK(owner->result_ok);
7830 return RoutingFees_clone(&*owner->contents.result);
7832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7833 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
7834 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
7835 uintptr_t ret_ref = 0;
7836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7839 ret_ref = (uintptr_t)ret_var.inner;
7840 if (ret_var.is_owned) {
7846 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7847 CHECK(!owner->result_ok);
7848 return DecodeError_clone(&*owner->contents.err);
7850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7851 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
7852 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
7853 uintptr_t ret_ref = 0;
7854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7857 ret_ref = (uintptr_t)ret_var.inner;
7858 if (ret_var.is_owned) {
7864 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7865 CHECK(owner->result_ok);
7866 return NodeAnnouncementInfo_clone(&*owner->contents.result);
7868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7869 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
7870 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
7871 uintptr_t ret_ref = 0;
7872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7875 ret_ref = (uintptr_t)ret_var.inner;
7876 if (ret_var.is_owned) {
7882 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7883 CHECK(!owner->result_ok);
7884 return DecodeError_clone(&*owner->contents.err);
7886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7887 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
7888 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
7889 uintptr_t ret_ref = 0;
7890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7893 ret_ref = (uintptr_t)ret_var.inner;
7894 if (ret_var.is_owned) {
7900 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
7901 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
7902 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
7905 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7906 CHECK(owner->result_ok);
7907 return NodeInfo_clone(&*owner->contents.result);
7909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7910 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
7911 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
7912 uintptr_t ret_ref = 0;
7913 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7914 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7916 ret_ref = (uintptr_t)ret_var.inner;
7917 if (ret_var.is_owned) {
7923 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7924 CHECK(!owner->result_ok);
7925 return DecodeError_clone(&*owner->contents.err);
7927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7928 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
7929 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
7930 uintptr_t ret_ref = 0;
7931 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7932 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7933 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7934 ret_ref = (uintptr_t)ret_var.inner;
7935 if (ret_var.is_owned) {
7941 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
7942 CHECK(owner->result_ok);
7943 return NetworkGraph_clone(&*owner->contents.result);
7945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7946 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
7947 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
7948 uintptr_t ret_ref = 0;
7949 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7950 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7952 ret_ref = (uintptr_t)ret_var.inner;
7953 if (ret_var.is_owned) {
7959 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
7960 CHECK(!owner->result_ok);
7961 return DecodeError_clone(&*owner->contents.err);
7963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7964 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
7965 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
7966 uintptr_t ret_ref = 0;
7967 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7968 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7969 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7970 ret_ref = (uintptr_t)ret_var.inner;
7971 if (ret_var.is_owned) {
7977 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
7978 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
7979 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
7980 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
7981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
7982 LDKCOption_CVec_NetAddressZZ_Some_class =
7983 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
7984 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
7985 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
7986 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
7987 LDKCOption_CVec_NetAddressZZ_None_class =
7988 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
7989 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
7990 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
7991 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
7993 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7994 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
7996 case LDKCOption_CVec_NetAddressZZ_Some: {
7997 LDKCVec_NetAddressZ some_var = obj->some;
7998 int64_tArray some_arr = NULL;
7999 some_arr = (*env)->NewLongArray(env, some_var.datalen);
8000 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
8001 for (size_t m = 0; m < some_var.datalen; m++) {
8002 uintptr_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
8003 some_arr_ptr[m] = some_conv_12_ref;
8005 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
8006 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
8008 case LDKCOption_CVec_NetAddressZZ_None: {
8009 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
8014 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8015 CHECK(owner->result_ok);
8016 return NetAddress_clone(&*owner->contents.result);
8018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8019 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8020 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8021 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8022 uintptr_t ret_ref = (uintptr_t)ret_copy;
8026 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8027 CHECK(!owner->result_ok);
8028 return DecodeError_clone(&*owner->contents.err);
8030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8031 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8032 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8033 uintptr_t ret_ref = 0;
8034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8037 ret_ref = (uintptr_t)ret_var.inner;
8038 if (ret_var.is_owned) {
8044 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8045 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8046 for (size_t i = 0; i < ret.datalen; i++) {
8047 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8051 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8052 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8053 for (size_t i = 0; i < ret.datalen; i++) {
8054 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8058 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8059 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8060 for (size_t i = 0; i < ret.datalen; i++) {
8061 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8065 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8066 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8067 for (size_t i = 0; i < ret.datalen; i++) {
8068 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8072 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8073 CHECK(owner->result_ok);
8074 return AcceptChannel_clone(&*owner->contents.result);
8076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8077 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8078 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_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_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *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_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8095 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8096 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_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 LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8109 CHECK(owner->result_ok);
8110 return AnnouncementSignatures_clone(&*owner->contents.result);
8112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8113 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8114 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_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_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *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_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8131 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8132 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_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 LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8145 CHECK(owner->result_ok);
8146 return ChannelReestablish_clone(&*owner->contents.result);
8148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8149 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8150 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_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_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *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_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8167 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8168 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_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 LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8181 CHECK(owner->result_ok);
8182 return ClosingSigned_clone(&*owner->contents.result);
8184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8185 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8186 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_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_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *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_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8203 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8204 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_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 LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8217 CHECK(owner->result_ok);
8218 return ClosingSignedFeeRange_clone(&*owner->contents.result);
8220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8221 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8222 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_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_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *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_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8239 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8240 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_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 LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8253 CHECK(owner->result_ok);
8254 return CommitmentSigned_clone(&*owner->contents.result);
8256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8257 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8258 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_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_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *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_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8275 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8276 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_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 LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8289 CHECK(owner->result_ok);
8290 return FundingCreated_clone(&*owner->contents.result);
8292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8293 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8294 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_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_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *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_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8311 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8312 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_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 LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8325 CHECK(owner->result_ok);
8326 return FundingSigned_clone(&*owner->contents.result);
8328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8329 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8330 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_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_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *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_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8347 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8348 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_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 LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
8361 CHECK(owner->result_ok);
8362 return FundingLocked_clone(&*owner->contents.result);
8364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8365 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
8366 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_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_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *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_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8383 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
8384 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_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 LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8397 CHECK(owner->result_ok);
8398 return Init_clone(&*owner->contents.result);
8400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8401 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
8402 LDKInit ret_var = CResult_InitDecodeErrorZ_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_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *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_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8419 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
8420 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_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 LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8433 CHECK(owner->result_ok);
8434 return OpenChannel_clone(&*owner->contents.result);
8436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8437 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8438 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_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_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *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_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8455 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8456 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_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 LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8469 CHECK(owner->result_ok);
8470 return RevokeAndACK_clone(&*owner->contents.result);
8472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8473 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8474 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_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_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *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_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8491 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8492 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_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 LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8505 CHECK(owner->result_ok);
8506 return Shutdown_clone(&*owner->contents.result);
8508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8509 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
8510 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_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_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *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_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8527 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
8528 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_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 LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8541 CHECK(owner->result_ok);
8542 return UpdateFailHTLC_clone(&*owner->contents.result);
8544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8545 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
8546 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_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_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *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_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8563 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
8564 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_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 LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8577 CHECK(owner->result_ok);
8578 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
8580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8581 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
8582 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_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_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *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_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8599 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
8600 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_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 LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8613 CHECK(owner->result_ok);
8614 return UpdateFee_clone(&*owner->contents.result);
8616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8617 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
8618 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_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_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *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_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8635 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
8636 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_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 LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8649 CHECK(owner->result_ok);
8650 return UpdateFulfillHTLC_clone(&*owner->contents.result);
8652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8653 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
8654 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_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_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *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_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8671 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
8672 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_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 LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8685 CHECK(owner->result_ok);
8686 return UpdateAddHTLC_clone(&*owner->contents.result);
8688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8689 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
8690 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_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_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *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_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8707 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
8708 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_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 LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8721 CHECK(owner->result_ok);
8722 return Ping_clone(&*owner->contents.result);
8724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8725 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
8726 LDKPing ret_var = CResult_PingDecodeErrorZ_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_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *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_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8743 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
8744 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_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 LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8757 CHECK(owner->result_ok);
8758 return Pong_clone(&*owner->contents.result);
8760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8761 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
8762 LDKPong ret_var = CResult_PongDecodeErrorZ_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_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *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_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8779 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
8780 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_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 inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8793 CHECK(owner->result_ok);
8794 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
8796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8797 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8798 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8799 uintptr_t ret_ref = 0;
8800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8803 ret_ref = (uintptr_t)ret_var.inner;
8804 if (ret_var.is_owned) {
8810 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8811 CHECK(!owner->result_ok);
8812 return DecodeError_clone(&*owner->contents.err);
8814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8815 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8816 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8817 uintptr_t ret_ref = 0;
8818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8821 ret_ref = (uintptr_t)ret_var.inner;
8822 if (ret_var.is_owned) {
8828 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8829 CHECK(owner->result_ok);
8830 return ChannelAnnouncement_clone(&*owner->contents.result);
8832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8833 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8834 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8835 uintptr_t ret_ref = 0;
8836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8839 ret_ref = (uintptr_t)ret_var.inner;
8840 if (ret_var.is_owned) {
8846 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8847 CHECK(!owner->result_ok);
8848 return DecodeError_clone(&*owner->contents.err);
8850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8851 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8852 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8853 uintptr_t ret_ref = 0;
8854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8857 ret_ref = (uintptr_t)ret_var.inner;
8858 if (ret_var.is_owned) {
8864 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8865 CHECK(owner->result_ok);
8866 return UnsignedChannelUpdate_clone(&*owner->contents.result);
8868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8869 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
8870 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8871 uintptr_t ret_ref = 0;
8872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8875 ret_ref = (uintptr_t)ret_var.inner;
8876 if (ret_var.is_owned) {
8882 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8883 CHECK(!owner->result_ok);
8884 return DecodeError_clone(&*owner->contents.err);
8886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8887 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
8888 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8889 uintptr_t ret_ref = 0;
8890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8893 ret_ref = (uintptr_t)ret_var.inner;
8894 if (ret_var.is_owned) {
8900 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8901 CHECK(owner->result_ok);
8902 return ChannelUpdate_clone(&*owner->contents.result);
8904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8905 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
8906 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8907 uintptr_t ret_ref = 0;
8908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8911 ret_ref = (uintptr_t)ret_var.inner;
8912 if (ret_var.is_owned) {
8918 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8919 CHECK(!owner->result_ok);
8920 return DecodeError_clone(&*owner->contents.err);
8922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8923 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
8924 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8925 uintptr_t ret_ref = 0;
8926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8929 ret_ref = (uintptr_t)ret_var.inner;
8930 if (ret_var.is_owned) {
8936 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8937 CHECK(owner->result_ok);
8938 return ErrorMessage_clone(&*owner->contents.result);
8940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8941 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
8942 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8943 uintptr_t ret_ref = 0;
8944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8947 ret_ref = (uintptr_t)ret_var.inner;
8948 if (ret_var.is_owned) {
8954 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8955 CHECK(!owner->result_ok);
8956 return DecodeError_clone(&*owner->contents.err);
8958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8959 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
8960 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8961 uintptr_t ret_ref = 0;
8962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8965 ret_ref = (uintptr_t)ret_var.inner;
8966 if (ret_var.is_owned) {
8972 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8973 CHECK(owner->result_ok);
8974 return WarningMessage_clone(&*owner->contents.result);
8976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8977 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
8978 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
8979 uintptr_t ret_ref = 0;
8980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8983 ret_ref = (uintptr_t)ret_var.inner;
8984 if (ret_var.is_owned) {
8990 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8991 CHECK(!owner->result_ok);
8992 return DecodeError_clone(&*owner->contents.err);
8994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8995 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
8996 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
8997 uintptr_t ret_ref = 0;
8998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9001 ret_ref = (uintptr_t)ret_var.inner;
9002 if (ret_var.is_owned) {
9008 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9009 CHECK(owner->result_ok);
9010 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
9012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9013 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9014 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9015 uintptr_t ret_ref = 0;
9016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9019 ret_ref = (uintptr_t)ret_var.inner;
9020 if (ret_var.is_owned) {
9026 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9027 CHECK(!owner->result_ok);
9028 return DecodeError_clone(&*owner->contents.err);
9030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9031 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9032 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9033 uintptr_t ret_ref = 0;
9034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9037 ret_ref = (uintptr_t)ret_var.inner;
9038 if (ret_var.is_owned) {
9044 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9045 CHECK(owner->result_ok);
9046 return NodeAnnouncement_clone(&*owner->contents.result);
9048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9049 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9050 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9051 uintptr_t ret_ref = 0;
9052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9055 ret_ref = (uintptr_t)ret_var.inner;
9056 if (ret_var.is_owned) {
9062 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9063 CHECK(!owner->result_ok);
9064 return DecodeError_clone(&*owner->contents.err);
9066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9067 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9068 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9069 uintptr_t ret_ref = 0;
9070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9073 ret_ref = (uintptr_t)ret_var.inner;
9074 if (ret_var.is_owned) {
9080 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9081 CHECK(owner->result_ok);
9082 return QueryShortChannelIds_clone(&*owner->contents.result);
9084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9085 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9086 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9087 uintptr_t ret_ref = 0;
9088 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9089 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9091 ret_ref = (uintptr_t)ret_var.inner;
9092 if (ret_var.is_owned) {
9098 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9099 CHECK(!owner->result_ok);
9100 return DecodeError_clone(&*owner->contents.err);
9102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9103 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9104 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9105 uintptr_t ret_ref = 0;
9106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9109 ret_ref = (uintptr_t)ret_var.inner;
9110 if (ret_var.is_owned) {
9116 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9117 CHECK(owner->result_ok);
9118 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
9120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9121 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9122 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9123 uintptr_t ret_ref = 0;
9124 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9125 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9127 ret_ref = (uintptr_t)ret_var.inner;
9128 if (ret_var.is_owned) {
9134 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9135 CHECK(!owner->result_ok);
9136 return DecodeError_clone(&*owner->contents.err);
9138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9139 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9140 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9141 uintptr_t ret_ref = 0;
9142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9145 ret_ref = (uintptr_t)ret_var.inner;
9146 if (ret_var.is_owned) {
9152 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9153 CHECK(owner->result_ok);
9154 return QueryChannelRange_clone(&*owner->contents.result);
9156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9157 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9158 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9159 uintptr_t ret_ref = 0;
9160 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9161 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9163 ret_ref = (uintptr_t)ret_var.inner;
9164 if (ret_var.is_owned) {
9170 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9171 CHECK(!owner->result_ok);
9172 return DecodeError_clone(&*owner->contents.err);
9174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9175 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9176 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9177 uintptr_t ret_ref = 0;
9178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9181 ret_ref = (uintptr_t)ret_var.inner;
9182 if (ret_var.is_owned) {
9188 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9189 CHECK(owner->result_ok);
9190 return ReplyChannelRange_clone(&*owner->contents.result);
9192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9193 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9194 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9195 uintptr_t ret_ref = 0;
9196 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9197 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9199 ret_ref = (uintptr_t)ret_var.inner;
9200 if (ret_var.is_owned) {
9206 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9207 CHECK(!owner->result_ok);
9208 return DecodeError_clone(&*owner->contents.err);
9210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9211 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9212 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9213 uintptr_t ret_ref = 0;
9214 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9215 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9217 ret_ref = (uintptr_t)ret_var.inner;
9218 if (ret_var.is_owned) {
9224 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9225 CHECK(owner->result_ok);
9226 return GossipTimestampFilter_clone(&*owner->contents.result);
9228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9229 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9230 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9231 uintptr_t ret_ref = 0;
9232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9235 ret_ref = (uintptr_t)ret_var.inner;
9236 if (ret_var.is_owned) {
9242 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9243 CHECK(!owner->result_ok);
9244 return DecodeError_clone(&*owner->contents.err);
9246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9247 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9248 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9249 uintptr_t ret_ref = 0;
9250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9253 ret_ref = (uintptr_t)ret_var.inner;
9254 if (ret_var.is_owned) {
9260 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9261 LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9262 for (size_t i = 0; i < ret.datalen; i++) {
9263 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9267 static jclass LDKSignOrCreationError_SignError_class = NULL;
9268 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
9269 static jclass LDKSignOrCreationError_CreationError_class = NULL;
9270 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
9271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
9272 LDKSignOrCreationError_SignError_class =
9273 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
9274 CHECK(LDKSignOrCreationError_SignError_class != NULL);
9275 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
9276 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
9277 LDKSignOrCreationError_CreationError_class =
9278 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
9279 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
9280 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
9281 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
9283 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9284 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
9286 case LDKSignOrCreationError_SignError: {
9287 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
9289 case LDKSignOrCreationError_CreationError: {
9290 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
9291 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
9296 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9297 CHECK(owner->result_ok);
9298 return Invoice_clone(&*owner->contents.result);
9300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9301 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9302 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9303 uintptr_t ret_ref = 0;
9304 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9305 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9307 ret_ref = (uintptr_t)ret_var.inner;
9308 if (ret_var.is_owned) {
9314 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9315 CHECK(!owner->result_ok);
9316 return SignOrCreationError_clone(&*owner->contents.err);
9318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9319 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9320 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9321 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9322 uintptr_t ret_ref = (uintptr_t)ret_copy;
9326 typedef struct LDKFilter_JCalls {
9327 atomic_size_t refcnt;
9330 jmethodID register_tx_meth;
9331 jmethodID register_output_meth;
9333 static void LDKFilter_JCalls_free(void* this_arg) {
9334 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9335 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9337 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9338 if (get_jenv_res == JNI_EDETACHED) {
9339 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9341 DO_ASSERT(get_jenv_res == JNI_OK);
9343 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9344 if (get_jenv_res == JNI_EDETACHED) {
9345 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9350 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
9351 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9353 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9354 if (get_jenv_res == JNI_EDETACHED) {
9355 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9357 DO_ASSERT(get_jenv_res == JNI_OK);
9359 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9360 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9361 LDKu8slice script_pubkey_var = script_pubkey;
9362 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
9363 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
9364 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9366 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
9367 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9368 (*env)->ExceptionDescribe(env);
9369 (*env)->FatalError(env, "A call to register_tx in LDKFilter 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 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
9376 LDKFilter_JCalls *j_calls = (LDKFilter_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 LDKWatchedOutput output_var = output;
9385 uintptr_t output_ref = 0;
9386 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9387 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9388 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
9389 output_ref = (uintptr_t)output_var.inner;
9390 if (output_var.is_owned) {
9393 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9395 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
9396 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9397 (*env)->ExceptionDescribe(env);
9398 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
9400 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9401 CHECK_ACCESS(ret_ptr);
9402 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
9404 if (get_jenv_res == JNI_EDETACHED) {
9405 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9409 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
9410 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
9411 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9413 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
9414 jclass c = (*env)->GetObjectClass(env, o);
9416 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
9417 atomic_init(&calls->refcnt, 1);
9418 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9419 calls->o = (*env)->NewWeakGlobalRef(env, o);
9420 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
9421 CHECK(calls->register_tx_meth != NULL);
9422 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
9423 CHECK(calls->register_output_meth != NULL);
9426 .this_arg = (void*) calls,
9427 .register_tx = register_tx_LDKFilter_jcall,
9428 .register_output = register_output_LDKFilter_jcall,
9429 .free = LDKFilter_JCalls_free,
9433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
9434 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9435 *res_ptr = LDKFilter_init(env, clz, o);
9436 return (uint64_t)res_ptr;
9438 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) {
9439 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9440 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9441 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9442 unsigned char txid_arr[32];
9443 CHECK((*env)->GetArrayLength(env, txid) == 32);
9444 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
9445 unsigned char (*txid_ref)[32] = &txid_arr;
9446 LDKu8slice script_pubkey_ref;
9447 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9448 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
9449 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
9450 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
9453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
9454 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9455 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9456 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9457 LDKWatchedOutput output_conv;
9458 output_conv.inner = (void*)(output & (~1));
9459 output_conv.is_owned = (output & 1) || (output == 0);
9460 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
9461 output_conv = WatchedOutput_clone(&output_conv);
9462 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9463 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
9464 uintptr_t ret_ref = (uintptr_t)ret_copy;
9468 static jclass LDKCOption_FilterZ_Some_class = NULL;
9469 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
9470 static jclass LDKCOption_FilterZ_None_class = NULL;
9471 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
9472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
9473 LDKCOption_FilterZ_Some_class =
9474 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
9475 CHECK(LDKCOption_FilterZ_Some_class != NULL);
9476 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
9477 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
9478 LDKCOption_FilterZ_None_class =
9479 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
9480 CHECK(LDKCOption_FilterZ_None_class != NULL);
9481 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
9482 CHECK(LDKCOption_FilterZ_None_meth != NULL);
9484 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9485 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
9487 case LDKCOption_FilterZ_Some: {
9488 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
9489 *some_ret = obj->some;
9490 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
9491 if ((*some_ret).free == LDKFilter_JCalls_free) {
9492 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9493 LDKFilter_JCalls_cloned(&(*some_ret));
9495 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uintptr_t)some_ret);
9497 case LDKCOption_FilterZ_None: {
9498 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
9503 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9504 CHECK(owner->result_ok);
9505 return &*owner->contents.result;
9507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9508 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
9509 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
9510 uintptr_t ret_ref = 0;
9511 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9512 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9513 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9514 ret_ref = (uintptr_t)ret_var.inner & ~1;
9518 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9519 CHECK(!owner->result_ok);
9520 return *owner->contents.err;
9522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9523 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
9524 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
9527 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
9528 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
9529 for (size_t i = 0; i < ret.datalen; i++) {
9530 ret.data[i] = OutPoint_clone(&orig->data[i]);
9534 typedef struct LDKMessageSendEventsProvider_JCalls {
9535 atomic_size_t refcnt;
9538 jmethodID get_and_clear_pending_msg_events_meth;
9539 } LDKMessageSendEventsProvider_JCalls;
9540 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
9541 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9542 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9544 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9545 if (get_jenv_res == JNI_EDETACHED) {
9546 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9548 DO_ASSERT(get_jenv_res == JNI_OK);
9550 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9551 if (get_jenv_res == JNI_EDETACHED) {
9552 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9557 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
9558 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9560 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9561 if (get_jenv_res == JNI_EDETACHED) {
9562 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9564 DO_ASSERT(get_jenv_res == JNI_OK);
9566 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9568 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
9569 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9570 (*env)->ExceptionDescribe(env);
9571 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
9573 LDKCVec_MessageSendEventZ ret_constr;
9574 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9575 if (ret_constr.datalen > 0)
9576 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9578 ret_constr.data = NULL;
9579 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9580 for (size_t s = 0; s < ret_constr.datalen; s++) {
9581 int64_t ret_conv_18 = ret_vals[s];
9582 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
9583 CHECK_ACCESS(ret_conv_18_ptr);
9584 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
9585 FREE((void*)ret_conv_18);
9586 ret_constr.data[s] = ret_conv_18_conv;
9588 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9589 if (get_jenv_res == JNI_EDETACHED) {
9590 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9594 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
9595 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
9596 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9598 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9599 jclass c = (*env)->GetObjectClass(env, o);
9601 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
9602 atomic_init(&calls->refcnt, 1);
9603 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9604 calls->o = (*env)->NewWeakGlobalRef(env, o);
9605 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
9606 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
9608 LDKMessageSendEventsProvider ret = {
9609 .this_arg = (void*) calls,
9610 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
9611 .free = LDKMessageSendEventsProvider_JCalls_free,
9615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9616 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9617 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
9618 return (uint64_t)res_ptr;
9620 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
9621 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9622 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9623 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
9624 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
9625 int64_tArray ret_arr = NULL;
9626 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9627 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9628 for (size_t s = 0; s < ret_var.datalen; s++) {
9629 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9630 *ret_conv_18_copy = ret_var.data[s];
9631 uintptr_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
9632 ret_arr_ptr[s] = ret_conv_18_ref;
9634 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9639 typedef struct LDKEventHandler_JCalls {
9640 atomic_size_t refcnt;
9643 jmethodID handle_event_meth;
9644 } LDKEventHandler_JCalls;
9645 static void LDKEventHandler_JCalls_free(void* this_arg) {
9646 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9647 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9649 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9650 if (get_jenv_res == JNI_EDETACHED) {
9651 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9653 DO_ASSERT(get_jenv_res == JNI_OK);
9655 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9656 if (get_jenv_res == JNI_EDETACHED) {
9657 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9662 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
9663 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9665 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9666 if (get_jenv_res == JNI_EDETACHED) {
9667 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9669 DO_ASSERT(get_jenv_res == JNI_OK);
9671 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
9672 *ret_event = Event_clone(event);
9673 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9675 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uintptr_t)ret_event);
9676 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9677 (*env)->ExceptionDescribe(env);
9678 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
9680 if (get_jenv_res == JNI_EDETACHED) {
9681 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9684 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
9685 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
9686 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9688 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
9689 jclass c = (*env)->GetObjectClass(env, o);
9691 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
9692 atomic_init(&calls->refcnt, 1);
9693 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9694 calls->o = (*env)->NewWeakGlobalRef(env, o);
9695 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
9696 CHECK(calls->handle_event_meth != NULL);
9698 LDKEventHandler ret = {
9699 .this_arg = (void*) calls,
9700 .handle_event = handle_event_LDKEventHandler_jcall,
9701 .free = LDKEventHandler_JCalls_free,
9705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
9706 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9707 *res_ptr = LDKEventHandler_init(env, clz, o);
9708 return (uint64_t)res_ptr;
9710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
9711 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9712 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9713 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
9714 LDKEvent* event_conv = (LDKEvent*)event;
9715 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
9718 typedef struct LDKEventsProvider_JCalls {
9719 atomic_size_t refcnt;
9722 jmethodID process_pending_events_meth;
9723 } LDKEventsProvider_JCalls;
9724 static void LDKEventsProvider_JCalls_free(void* this_arg) {
9725 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9726 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9728 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9729 if (get_jenv_res == JNI_EDETACHED) {
9730 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9732 DO_ASSERT(get_jenv_res == JNI_OK);
9734 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9735 if (get_jenv_res == JNI_EDETACHED) {
9736 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9741 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
9742 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9744 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9745 if (get_jenv_res == JNI_EDETACHED) {
9746 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9748 DO_ASSERT(get_jenv_res == JNI_OK);
9750 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9751 *handler_ret = handler;
9752 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9754 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uintptr_t)handler_ret);
9755 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9756 (*env)->ExceptionDescribe(env);
9757 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
9759 if (get_jenv_res == JNI_EDETACHED) {
9760 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9763 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
9764 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
9765 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9767 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9768 jclass c = (*env)->GetObjectClass(env, o);
9770 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
9771 atomic_init(&calls->refcnt, 1);
9772 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9773 calls->o = (*env)->NewWeakGlobalRef(env, o);
9774 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
9775 CHECK(calls->process_pending_events_meth != NULL);
9777 LDKEventsProvider ret = {
9778 .this_arg = (void*) calls,
9779 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
9780 .free = LDKEventsProvider_JCalls_free,
9784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9785 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9786 *res_ptr = LDKEventsProvider_init(env, clz, o);
9787 return (uint64_t)res_ptr;
9789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
9790 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9791 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9792 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
9793 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
9794 CHECK_ACCESS(handler_ptr);
9795 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
9796 if (handler_conv.free == LDKEventHandler_JCalls_free) {
9797 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9798 LDKEventHandler_JCalls_cloned(&handler_conv);
9800 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
9803 typedef struct LDKListen_JCalls {
9804 atomic_size_t refcnt;
9807 jmethodID block_connected_meth;
9808 jmethodID block_disconnected_meth;
9810 static void LDKListen_JCalls_free(void* this_arg) {
9811 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9812 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9814 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9815 if (get_jenv_res == JNI_EDETACHED) {
9816 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9818 DO_ASSERT(get_jenv_res == JNI_OK);
9820 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9821 if (get_jenv_res == JNI_EDETACHED) {
9822 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9827 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
9828 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9830 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9831 if (get_jenv_res == JNI_EDETACHED) {
9832 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9834 DO_ASSERT(get_jenv_res == JNI_OK);
9836 LDKu8slice block_var = block;
9837 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
9838 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
9839 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9841 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
9842 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9843 (*env)->ExceptionDescribe(env);
9844 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
9846 if (get_jenv_res == JNI_EDETACHED) {
9847 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9850 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9851 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9853 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9854 if (get_jenv_res == JNI_EDETACHED) {
9855 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9857 DO_ASSERT(get_jenv_res == JNI_OK);
9859 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
9860 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
9861 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9863 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
9864 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9865 (*env)->ExceptionDescribe(env);
9866 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
9868 if (get_jenv_res == JNI_EDETACHED) {
9869 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9872 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
9873 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
9874 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9876 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
9877 jclass c = (*env)->GetObjectClass(env, o);
9879 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
9880 atomic_init(&calls->refcnt, 1);
9881 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9882 calls->o = (*env)->NewWeakGlobalRef(env, o);
9883 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
9884 CHECK(calls->block_connected_meth != NULL);
9885 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
9886 CHECK(calls->block_disconnected_meth != NULL);
9889 .this_arg = (void*) calls,
9890 .block_connected = block_connected_LDKListen_jcall,
9891 .block_disconnected = block_disconnected_LDKListen_jcall,
9892 .free = LDKListen_JCalls_free,
9896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
9897 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
9898 *res_ptr = LDKListen_init(env, clz, o);
9899 return (uint64_t)res_ptr;
9901 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) {
9902 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9903 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9904 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9905 LDKu8slice block_ref;
9906 block_ref.datalen = (*env)->GetArrayLength(env, block);
9907 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
9908 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
9909 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
9912 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) {
9913 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9914 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9915 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9916 unsigned char header_arr[80];
9917 CHECK((*env)->GetArrayLength(env, header) == 80);
9918 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9919 unsigned char (*header_ref)[80] = &header_arr;
9920 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
9923 typedef struct LDKConfirm_JCalls {
9924 atomic_size_t refcnt;
9927 jmethodID transactions_confirmed_meth;
9928 jmethodID transaction_unconfirmed_meth;
9929 jmethodID best_block_updated_meth;
9930 jmethodID get_relevant_txids_meth;
9931 } LDKConfirm_JCalls;
9932 static void LDKConfirm_JCalls_free(void* this_arg) {
9933 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9934 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9936 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9937 if (get_jenv_res == JNI_EDETACHED) {
9938 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9940 DO_ASSERT(get_jenv_res == JNI_OK);
9942 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9943 if (get_jenv_res == JNI_EDETACHED) {
9944 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9949 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9950 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9952 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9953 if (get_jenv_res == JNI_EDETACHED) {
9954 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9956 DO_ASSERT(get_jenv_res == JNI_OK);
9958 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
9959 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
9960 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9961 int64_tArray txdata_arr = NULL;
9962 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
9963 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
9964 for (size_t c = 0; c < txdata_var.datalen; c++) {
9965 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9966 *txdata_conv_28_conv = txdata_var.data[c];
9967 txdata_arr_ptr[c] = ((uintptr_t)txdata_conv_28_conv);
9969 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
9970 FREE(txdata_var.data);
9971 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9973 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
9974 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9975 (*env)->ExceptionDescribe(env);
9976 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
9978 if (get_jenv_res == JNI_EDETACHED) {
9979 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9982 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
9983 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9985 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9986 if (get_jenv_res == JNI_EDETACHED) {
9987 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9989 DO_ASSERT(get_jenv_res == JNI_OK);
9991 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9992 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9993 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9995 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
9996 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9997 (*env)->ExceptionDescribe(env);
9998 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
10000 if (get_jenv_res == JNI_EDETACHED) {
10001 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10004 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10005 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10007 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10008 if (get_jenv_res == JNI_EDETACHED) {
10009 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10011 DO_ASSERT(get_jenv_res == JNI_OK);
10013 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10014 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10015 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10016 CHECK(obj != NULL);
10017 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
10018 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10019 (*env)->ExceptionDescribe(env);
10020 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
10022 if (get_jenv_res == JNI_EDETACHED) {
10023 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10026 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
10027 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10029 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10030 if (get_jenv_res == JNI_EDETACHED) {
10031 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10033 DO_ASSERT(get_jenv_res == JNI_OK);
10035 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10036 CHECK(obj != NULL);
10037 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
10038 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10039 (*env)->ExceptionDescribe(env);
10040 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
10042 LDKCVec_TxidZ ret_constr;
10043 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10044 if (ret_constr.datalen > 0)
10045 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10047 ret_constr.data = NULL;
10048 for (size_t i = 0; i < ret_constr.datalen; i++) {
10049 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
10050 LDKThirtyTwoBytes ret_conv_8_ref;
10051 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
10052 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
10053 ret_constr.data[i] = ret_conv_8_ref;
10055 if (get_jenv_res == JNI_EDETACHED) {
10056 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10060 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
10061 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
10062 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10064 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
10065 jclass c = (*env)->GetObjectClass(env, o);
10067 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
10068 atomic_init(&calls->refcnt, 1);
10069 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10070 calls->o = (*env)->NewWeakGlobalRef(env, o);
10071 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
10072 CHECK(calls->transactions_confirmed_meth != NULL);
10073 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
10074 CHECK(calls->transaction_unconfirmed_meth != NULL);
10075 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
10076 CHECK(calls->best_block_updated_meth != NULL);
10077 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
10078 CHECK(calls->get_relevant_txids_meth != NULL);
10081 .this_arg = (void*) calls,
10082 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
10083 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
10084 .best_block_updated = best_block_updated_LDKConfirm_jcall,
10085 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
10086 .free = LDKConfirm_JCalls_free,
10090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
10091 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
10092 *res_ptr = LDKConfirm_init(env, clz, o);
10093 return (uint64_t)res_ptr;
10095 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) {
10096 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10097 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10098 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10099 unsigned char header_arr[80];
10100 CHECK((*env)->GetArrayLength(env, header) == 80);
10101 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10102 unsigned char (*header_ref)[80] = &header_arr;
10103 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10104 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10105 if (txdata_constr.datalen > 0)
10106 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10108 txdata_constr.data = NULL;
10109 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10110 for (size_t c = 0; c < txdata_constr.datalen; c++) {
10111 int64_t txdata_conv_28 = txdata_vals[c];
10112 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
10113 CHECK_ACCESS(txdata_conv_28_ptr);
10114 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10115 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
10116 txdata_constr.data[c] = txdata_conv_28_conv;
10118 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10119 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
10123 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10124 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10125 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10126 unsigned char txid_arr[32];
10127 CHECK((*env)->GetArrayLength(env, txid) == 32);
10128 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10129 unsigned char (*txid_ref)[32] = &txid_arr;
10130 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
10133 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) {
10134 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10135 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10136 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10137 unsigned char header_arr[80];
10138 CHECK((*env)->GetArrayLength(env, header) == 80);
10139 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10140 unsigned char (*header_ref)[80] = &header_arr;
10141 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
10144 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
10145 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10146 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10147 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10148 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
10149 jobjectArray ret_arr = NULL;
10150 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10152 for (size_t i = 0; i < ret_var.datalen; i++) {
10153 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
10154 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
10155 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
10158 FREE(ret_var.data);
10162 typedef struct LDKPersist_JCalls {
10163 atomic_size_t refcnt;
10166 jmethodID persist_new_channel_meth;
10167 jmethodID update_persisted_channel_meth;
10168 } LDKPersist_JCalls;
10169 static void LDKPersist_JCalls_free(void* this_arg) {
10170 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10171 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10173 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10174 if (get_jenv_res == JNI_EDETACHED) {
10175 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10177 DO_ASSERT(get_jenv_res == JNI_OK);
10179 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10180 if (get_jenv_res == JNI_EDETACHED) {
10181 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10186 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10187 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10189 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10190 if (get_jenv_res == JNI_EDETACHED) {
10191 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10193 DO_ASSERT(get_jenv_res == JNI_OK);
10195 LDKOutPoint channel_id_var = channel_id;
10196 uintptr_t channel_id_ref = 0;
10197 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10198 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10199 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10200 channel_id_ref = (uintptr_t)channel_id_var.inner;
10201 if (channel_id_var.is_owned) {
10202 channel_id_ref |= 1;
10204 LDKChannelMonitor data_var = *data;
10205 uintptr_t data_ref = 0;
10206 data_var = ChannelMonitor_clone(data);
10207 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10208 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10209 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10210 data_ref = (uintptr_t)data_var.inner;
10211 if (data_var.is_owned) {
10214 LDKMonitorUpdateId update_id_var = update_id;
10215 uintptr_t update_id_ref = 0;
10216 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10217 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10218 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10219 update_id_ref = (uintptr_t)update_id_var.inner;
10220 if (update_id_var.is_owned) {
10221 update_id_ref |= 1;
10223 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10224 CHECK(obj != NULL);
10225 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
10226 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10227 (*env)->ExceptionDescribe(env);
10228 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
10230 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10231 CHECK_ACCESS(ret_ptr);
10232 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10234 if (get_jenv_res == JNI_EDETACHED) {
10235 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10239 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10240 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10242 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10243 if (get_jenv_res == JNI_EDETACHED) {
10244 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10246 DO_ASSERT(get_jenv_res == JNI_OK);
10248 LDKOutPoint channel_id_var = channel_id;
10249 uintptr_t channel_id_ref = 0;
10250 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10251 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10252 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10253 channel_id_ref = (uintptr_t)channel_id_var.inner;
10254 if (channel_id_var.is_owned) {
10255 channel_id_ref |= 1;
10257 LDKChannelMonitorUpdate update_var = *update;
10258 uintptr_t update_ref = 0;
10259 if ((uintptr_t)update_var.inner > 4096) {
10260 update_var = ChannelMonitorUpdate_clone(update);
10261 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10262 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10263 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
10264 update_ref = (uintptr_t)update_var.inner;
10265 if (update_var.is_owned) {
10269 LDKChannelMonitor data_var = *data;
10270 uintptr_t data_ref = 0;
10271 data_var = ChannelMonitor_clone(data);
10272 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10273 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10274 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10275 data_ref = (uintptr_t)data_var.inner;
10276 if (data_var.is_owned) {
10279 LDKMonitorUpdateId update_id_var = update_id;
10280 uintptr_t update_id_ref = 0;
10281 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10282 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10283 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10284 update_id_ref = (uintptr_t)update_id_var.inner;
10285 if (update_id_var.is_owned) {
10286 update_id_ref |= 1;
10288 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10289 CHECK(obj != NULL);
10290 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
10291 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10292 (*env)->ExceptionDescribe(env);
10293 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
10295 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10296 CHECK_ACCESS(ret_ptr);
10297 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10299 if (get_jenv_res == JNI_EDETACHED) {
10300 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10304 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
10305 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
10306 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10308 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
10309 jclass c = (*env)->GetObjectClass(env, o);
10311 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
10312 atomic_init(&calls->refcnt, 1);
10313 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10314 calls->o = (*env)->NewWeakGlobalRef(env, o);
10315 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
10316 CHECK(calls->persist_new_channel_meth != NULL);
10317 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
10318 CHECK(calls->update_persisted_channel_meth != NULL);
10321 .this_arg = (void*) calls,
10322 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
10323 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
10324 .free = LDKPersist_JCalls_free,
10328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
10329 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
10330 *res_ptr = LDKPersist_init(env, clz, o);
10331 return (uint64_t)res_ptr;
10333 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) {
10334 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10335 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10336 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10337 LDKOutPoint channel_id_conv;
10338 channel_id_conv.inner = (void*)(channel_id & (~1));
10339 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
10340 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10341 channel_id_conv = OutPoint_clone(&channel_id_conv);
10342 LDKChannelMonitor data_conv;
10343 data_conv.inner = (void*)(data & (~1));
10344 data_conv.is_owned = false;
10345 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10346 LDKMonitorUpdateId update_id_conv;
10347 update_id_conv.inner = (void*)(update_id & (~1));
10348 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
10349 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10350 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10351 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10352 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
10353 return (uintptr_t)ret_conv;
10356 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) {
10357 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10358 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10359 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10360 LDKOutPoint channel_id_conv;
10361 channel_id_conv.inner = (void*)(channel_id & (~1));
10362 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
10363 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10364 channel_id_conv = OutPoint_clone(&channel_id_conv);
10365 LDKChannelMonitorUpdate update_conv;
10366 update_conv.inner = (void*)(update & (~1));
10367 update_conv.is_owned = false;
10368 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
10369 LDKChannelMonitor data_conv;
10370 data_conv.inner = (void*)(data & (~1));
10371 data_conv.is_owned = false;
10372 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10373 LDKMonitorUpdateId update_id_conv;
10374 update_id_conv.inner = (void*)(update_id & (~1));
10375 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
10376 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10377 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10378 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10379 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
10380 return (uintptr_t)ret_conv;
10383 typedef struct LDKChannelMessageHandler_JCalls {
10384 atomic_size_t refcnt;
10387 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10388 jmethodID handle_open_channel_meth;
10389 jmethodID handle_accept_channel_meth;
10390 jmethodID handle_funding_created_meth;
10391 jmethodID handle_funding_signed_meth;
10392 jmethodID handle_funding_locked_meth;
10393 jmethodID handle_shutdown_meth;
10394 jmethodID handle_closing_signed_meth;
10395 jmethodID handle_update_add_htlc_meth;
10396 jmethodID handle_update_fulfill_htlc_meth;
10397 jmethodID handle_update_fail_htlc_meth;
10398 jmethodID handle_update_fail_malformed_htlc_meth;
10399 jmethodID handle_commitment_signed_meth;
10400 jmethodID handle_revoke_and_ack_meth;
10401 jmethodID handle_update_fee_meth;
10402 jmethodID handle_announcement_signatures_meth;
10403 jmethodID peer_disconnected_meth;
10404 jmethodID peer_connected_meth;
10405 jmethodID handle_channel_reestablish_meth;
10406 jmethodID handle_channel_update_meth;
10407 jmethodID handle_error_meth;
10408 } LDKChannelMessageHandler_JCalls;
10409 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
10410 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10411 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10413 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10414 if (get_jenv_res == JNI_EDETACHED) {
10415 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10417 DO_ASSERT(get_jenv_res == JNI_OK);
10419 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10420 if (get_jenv_res == JNI_EDETACHED) {
10421 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10426 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
10427 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10429 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10430 if (get_jenv_res == JNI_EDETACHED) {
10431 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10433 DO_ASSERT(get_jenv_res == JNI_OK);
10435 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10436 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10437 LDKInitFeatures their_features_var = their_features;
10438 uintptr_t their_features_ref = 0;
10439 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10440 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10441 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10442 their_features_ref = (uintptr_t)their_features_var.inner;
10443 if (their_features_var.is_owned) {
10444 their_features_ref |= 1;
10446 LDKOpenChannel msg_var = *msg;
10447 uintptr_t msg_ref = 0;
10448 msg_var = OpenChannel_clone(msg);
10449 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10450 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10451 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10452 msg_ref = (uintptr_t)msg_var.inner;
10453 if (msg_var.is_owned) {
10456 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10457 CHECK(obj != NULL);
10458 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10459 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10460 (*env)->ExceptionDescribe(env);
10461 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
10463 if (get_jenv_res == JNI_EDETACHED) {
10464 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10467 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
10468 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10470 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10471 if (get_jenv_res == JNI_EDETACHED) {
10472 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10474 DO_ASSERT(get_jenv_res == JNI_OK);
10476 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10477 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10478 LDKInitFeatures their_features_var = their_features;
10479 uintptr_t their_features_ref = 0;
10480 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10481 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10482 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10483 their_features_ref = (uintptr_t)their_features_var.inner;
10484 if (their_features_var.is_owned) {
10485 their_features_ref |= 1;
10487 LDKAcceptChannel msg_var = *msg;
10488 uintptr_t msg_ref = 0;
10489 msg_var = AcceptChannel_clone(msg);
10490 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10491 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10492 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10493 msg_ref = (uintptr_t)msg_var.inner;
10494 if (msg_var.is_owned) {
10497 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10498 CHECK(obj != NULL);
10499 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10500 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10501 (*env)->ExceptionDescribe(env);
10502 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
10504 if (get_jenv_res == JNI_EDETACHED) {
10505 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10508 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
10509 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10511 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10512 if (get_jenv_res == JNI_EDETACHED) {
10513 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10515 DO_ASSERT(get_jenv_res == JNI_OK);
10517 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10518 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10519 LDKFundingCreated msg_var = *msg;
10520 uintptr_t msg_ref = 0;
10521 msg_var = FundingCreated_clone(msg);
10522 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10523 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10524 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10525 msg_ref = (uintptr_t)msg_var.inner;
10526 if (msg_var.is_owned) {
10529 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10530 CHECK(obj != NULL);
10531 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
10532 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10533 (*env)->ExceptionDescribe(env);
10534 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
10536 if (get_jenv_res == JNI_EDETACHED) {
10537 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10540 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
10541 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10543 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10544 if (get_jenv_res == JNI_EDETACHED) {
10545 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10547 DO_ASSERT(get_jenv_res == JNI_OK);
10549 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10550 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10551 LDKFundingSigned msg_var = *msg;
10552 uintptr_t msg_ref = 0;
10553 msg_var = FundingSigned_clone(msg);
10554 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10555 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10556 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10557 msg_ref = (uintptr_t)msg_var.inner;
10558 if (msg_var.is_owned) {
10561 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10562 CHECK(obj != NULL);
10563 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
10564 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10565 (*env)->ExceptionDescribe(env);
10566 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
10568 if (get_jenv_res == JNI_EDETACHED) {
10569 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10572 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
10573 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10575 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10576 if (get_jenv_res == JNI_EDETACHED) {
10577 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10579 DO_ASSERT(get_jenv_res == JNI_OK);
10581 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10582 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10583 LDKFundingLocked msg_var = *msg;
10584 uintptr_t msg_ref = 0;
10585 msg_var = FundingLocked_clone(msg);
10586 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10587 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10588 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10589 msg_ref = (uintptr_t)msg_var.inner;
10590 if (msg_var.is_owned) {
10593 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10594 CHECK(obj != NULL);
10595 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
10596 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10597 (*env)->ExceptionDescribe(env);
10598 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
10600 if (get_jenv_res == JNI_EDETACHED) {
10601 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10604 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
10605 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10607 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10608 if (get_jenv_res == JNI_EDETACHED) {
10609 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10611 DO_ASSERT(get_jenv_res == JNI_OK);
10613 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10614 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10615 LDKInitFeatures their_features_var = *their_features;
10616 uintptr_t their_features_ref = 0;
10617 their_features_var = InitFeatures_clone(their_features);
10618 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10619 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10620 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10621 their_features_ref = (uintptr_t)their_features_var.inner;
10622 if (their_features_var.is_owned) {
10623 their_features_ref |= 1;
10625 LDKShutdown msg_var = *msg;
10626 uintptr_t msg_ref = 0;
10627 msg_var = Shutdown_clone(msg);
10628 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10629 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10630 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10631 msg_ref = (uintptr_t)msg_var.inner;
10632 if (msg_var.is_owned) {
10635 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10636 CHECK(obj != NULL);
10637 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
10638 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10639 (*env)->ExceptionDescribe(env);
10640 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
10642 if (get_jenv_res == JNI_EDETACHED) {
10643 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10646 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
10647 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10649 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10650 if (get_jenv_res == JNI_EDETACHED) {
10651 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10653 DO_ASSERT(get_jenv_res == JNI_OK);
10655 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10656 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10657 LDKClosingSigned msg_var = *msg;
10658 uintptr_t msg_ref = 0;
10659 msg_var = ClosingSigned_clone(msg);
10660 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10661 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10662 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10663 msg_ref = (uintptr_t)msg_var.inner;
10664 if (msg_var.is_owned) {
10667 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10668 CHECK(obj != NULL);
10669 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
10670 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10671 (*env)->ExceptionDescribe(env);
10672 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
10674 if (get_jenv_res == JNI_EDETACHED) {
10675 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10678 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
10679 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10681 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10682 if (get_jenv_res == JNI_EDETACHED) {
10683 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10685 DO_ASSERT(get_jenv_res == JNI_OK);
10687 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10688 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10689 LDKUpdateAddHTLC msg_var = *msg;
10690 uintptr_t msg_ref = 0;
10691 msg_var = UpdateAddHTLC_clone(msg);
10692 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10693 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10694 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10695 msg_ref = (uintptr_t)msg_var.inner;
10696 if (msg_var.is_owned) {
10699 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10700 CHECK(obj != NULL);
10701 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
10702 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10703 (*env)->ExceptionDescribe(env);
10704 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
10706 if (get_jenv_res == JNI_EDETACHED) {
10707 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10710 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
10711 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10713 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10714 if (get_jenv_res == JNI_EDETACHED) {
10715 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10717 DO_ASSERT(get_jenv_res == JNI_OK);
10719 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10720 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10721 LDKUpdateFulfillHTLC msg_var = *msg;
10722 uintptr_t msg_ref = 0;
10723 msg_var = UpdateFulfillHTLC_clone(msg);
10724 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10725 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10726 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10727 msg_ref = (uintptr_t)msg_var.inner;
10728 if (msg_var.is_owned) {
10731 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10732 CHECK(obj != NULL);
10733 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
10734 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10735 (*env)->ExceptionDescribe(env);
10736 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
10738 if (get_jenv_res == JNI_EDETACHED) {
10739 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10742 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
10743 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10745 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10746 if (get_jenv_res == JNI_EDETACHED) {
10747 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10749 DO_ASSERT(get_jenv_res == JNI_OK);
10751 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10752 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10753 LDKUpdateFailHTLC msg_var = *msg;
10754 uintptr_t msg_ref = 0;
10755 msg_var = UpdateFailHTLC_clone(msg);
10756 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10757 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10758 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10759 msg_ref = (uintptr_t)msg_var.inner;
10760 if (msg_var.is_owned) {
10763 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10764 CHECK(obj != NULL);
10765 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
10766 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10767 (*env)->ExceptionDescribe(env);
10768 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
10770 if (get_jenv_res == JNI_EDETACHED) {
10771 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10774 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
10775 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10777 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10778 if (get_jenv_res == JNI_EDETACHED) {
10779 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10781 DO_ASSERT(get_jenv_res == JNI_OK);
10783 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10784 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10785 LDKUpdateFailMalformedHTLC msg_var = *msg;
10786 uintptr_t msg_ref = 0;
10787 msg_var = UpdateFailMalformedHTLC_clone(msg);
10788 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10789 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10790 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10791 msg_ref = (uintptr_t)msg_var.inner;
10792 if (msg_var.is_owned) {
10795 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10796 CHECK(obj != NULL);
10797 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
10798 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10799 (*env)->ExceptionDescribe(env);
10800 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
10802 if (get_jenv_res == JNI_EDETACHED) {
10803 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10806 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
10807 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10809 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10810 if (get_jenv_res == JNI_EDETACHED) {
10811 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10813 DO_ASSERT(get_jenv_res == JNI_OK);
10815 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10816 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10817 LDKCommitmentSigned msg_var = *msg;
10818 uintptr_t msg_ref = 0;
10819 msg_var = CommitmentSigned_clone(msg);
10820 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10821 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10822 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10823 msg_ref = (uintptr_t)msg_var.inner;
10824 if (msg_var.is_owned) {
10827 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10828 CHECK(obj != NULL);
10829 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
10830 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10831 (*env)->ExceptionDescribe(env);
10832 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
10834 if (get_jenv_res == JNI_EDETACHED) {
10835 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10838 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
10839 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10841 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10842 if (get_jenv_res == JNI_EDETACHED) {
10843 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10845 DO_ASSERT(get_jenv_res == JNI_OK);
10847 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10848 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10849 LDKRevokeAndACK msg_var = *msg;
10850 uintptr_t msg_ref = 0;
10851 msg_var = RevokeAndACK_clone(msg);
10852 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10853 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10854 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10855 msg_ref = (uintptr_t)msg_var.inner;
10856 if (msg_var.is_owned) {
10859 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10860 CHECK(obj != NULL);
10861 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
10862 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10863 (*env)->ExceptionDescribe(env);
10864 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
10866 if (get_jenv_res == JNI_EDETACHED) {
10867 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10870 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
10871 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10873 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10874 if (get_jenv_res == JNI_EDETACHED) {
10875 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10877 DO_ASSERT(get_jenv_res == JNI_OK);
10879 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10880 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10881 LDKUpdateFee msg_var = *msg;
10882 uintptr_t msg_ref = 0;
10883 msg_var = UpdateFee_clone(msg);
10884 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10885 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10886 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10887 msg_ref = (uintptr_t)msg_var.inner;
10888 if (msg_var.is_owned) {
10891 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10892 CHECK(obj != NULL);
10893 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
10894 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10895 (*env)->ExceptionDescribe(env);
10896 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
10898 if (get_jenv_res == JNI_EDETACHED) {
10899 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10902 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
10903 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10905 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10906 if (get_jenv_res == JNI_EDETACHED) {
10907 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10909 DO_ASSERT(get_jenv_res == JNI_OK);
10911 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10912 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10913 LDKAnnouncementSignatures msg_var = *msg;
10914 uintptr_t msg_ref = 0;
10915 msg_var = AnnouncementSignatures_clone(msg);
10916 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10917 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10918 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10919 msg_ref = (uintptr_t)msg_var.inner;
10920 if (msg_var.is_owned) {
10923 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10924 CHECK(obj != NULL);
10925 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
10926 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10927 (*env)->ExceptionDescribe(env);
10928 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
10930 if (get_jenv_res == JNI_EDETACHED) {
10931 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10934 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
10935 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10937 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10938 if (get_jenv_res == JNI_EDETACHED) {
10939 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10941 DO_ASSERT(get_jenv_res == JNI_OK);
10943 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10944 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10945 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10946 CHECK(obj != NULL);
10947 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
10948 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10949 (*env)->ExceptionDescribe(env);
10950 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
10952 if (get_jenv_res == JNI_EDETACHED) {
10953 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10956 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
10957 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10959 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10960 if (get_jenv_res == JNI_EDETACHED) {
10961 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10963 DO_ASSERT(get_jenv_res == JNI_OK);
10965 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10966 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10967 LDKInit msg_var = *msg;
10968 uintptr_t msg_ref = 0;
10969 msg_var = Init_clone(msg);
10970 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10971 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10972 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10973 msg_ref = (uintptr_t)msg_var.inner;
10974 if (msg_var.is_owned) {
10977 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10978 CHECK(obj != NULL);
10979 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
10980 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10981 (*env)->ExceptionDescribe(env);
10982 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
10984 if (get_jenv_res == JNI_EDETACHED) {
10985 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10988 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
10989 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10991 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10992 if (get_jenv_res == JNI_EDETACHED) {
10993 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10995 DO_ASSERT(get_jenv_res == JNI_OK);
10997 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10998 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10999 LDKChannelReestablish msg_var = *msg;
11000 uintptr_t msg_ref = 0;
11001 msg_var = ChannelReestablish_clone(msg);
11002 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11003 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11004 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11005 msg_ref = (uintptr_t)msg_var.inner;
11006 if (msg_var.is_owned) {
11009 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11010 CHECK(obj != NULL);
11011 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
11012 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11013 (*env)->ExceptionDescribe(env);
11014 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
11016 if (get_jenv_res == JNI_EDETACHED) {
11017 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11020 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
11021 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11023 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11024 if (get_jenv_res == JNI_EDETACHED) {
11025 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11027 DO_ASSERT(get_jenv_res == JNI_OK);
11029 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11030 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11031 LDKChannelUpdate msg_var = *msg;
11032 uintptr_t msg_ref = 0;
11033 msg_var = ChannelUpdate_clone(msg);
11034 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11035 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11036 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11037 msg_ref = (uintptr_t)msg_var.inner;
11038 if (msg_var.is_owned) {
11041 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11042 CHECK(obj != NULL);
11043 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
11044 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11045 (*env)->ExceptionDescribe(env);
11046 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
11048 if (get_jenv_res == JNI_EDETACHED) {
11049 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11052 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
11053 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11055 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11056 if (get_jenv_res == JNI_EDETACHED) {
11057 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11059 DO_ASSERT(get_jenv_res == JNI_OK);
11061 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11062 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11063 LDKErrorMessage msg_var = *msg;
11064 uintptr_t msg_ref = 0;
11065 msg_var = ErrorMessage_clone(msg);
11066 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11067 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11068 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11069 msg_ref = (uintptr_t)msg_var.inner;
11070 if (msg_var.is_owned) {
11073 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11074 CHECK(obj != NULL);
11075 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
11076 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11077 (*env)->ExceptionDescribe(env);
11078 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
11080 if (get_jenv_res == JNI_EDETACHED) {
11081 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11084 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
11085 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
11086 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11087 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11089 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11090 jclass c = (*env)->GetObjectClass(env, o);
11092 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
11093 atomic_init(&calls->refcnt, 1);
11094 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11095 calls->o = (*env)->NewWeakGlobalRef(env, o);
11096 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
11097 CHECK(calls->handle_open_channel_meth != NULL);
11098 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
11099 CHECK(calls->handle_accept_channel_meth != NULL);
11100 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
11101 CHECK(calls->handle_funding_created_meth != NULL);
11102 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
11103 CHECK(calls->handle_funding_signed_meth != NULL);
11104 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
11105 CHECK(calls->handle_funding_locked_meth != NULL);
11106 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
11107 CHECK(calls->handle_shutdown_meth != NULL);
11108 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
11109 CHECK(calls->handle_closing_signed_meth != NULL);
11110 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
11111 CHECK(calls->handle_update_add_htlc_meth != NULL);
11112 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
11113 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
11114 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
11115 CHECK(calls->handle_update_fail_htlc_meth != NULL);
11116 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
11117 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
11118 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
11119 CHECK(calls->handle_commitment_signed_meth != NULL);
11120 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
11121 CHECK(calls->handle_revoke_and_ack_meth != NULL);
11122 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
11123 CHECK(calls->handle_update_fee_meth != NULL);
11124 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
11125 CHECK(calls->handle_announcement_signatures_meth != NULL);
11126 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
11127 CHECK(calls->peer_disconnected_meth != NULL);
11128 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
11129 CHECK(calls->peer_connected_meth != NULL);
11130 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
11131 CHECK(calls->handle_channel_reestablish_meth != NULL);
11132 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
11133 CHECK(calls->handle_channel_update_meth != NULL);
11134 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
11135 CHECK(calls->handle_error_meth != NULL);
11137 LDKChannelMessageHandler ret = {
11138 .this_arg = (void*) calls,
11139 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
11140 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
11141 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
11142 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
11143 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
11144 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
11145 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
11146 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
11147 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
11148 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
11149 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
11150 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
11151 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
11152 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
11153 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
11154 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
11155 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
11156 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
11157 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
11158 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
11159 .free = LDKChannelMessageHandler_JCalls_free,
11160 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
11162 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
11165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11166 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11167 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
11168 return (uint64_t)res_ptr;
11170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
11171 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
11172 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
11173 DO_ASSERT((res_ptr & 1) == 0);
11174 return (int64_t)(res_ptr | 1);
11176 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) {
11177 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11178 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11179 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11180 LDKPublicKey their_node_id_ref;
11181 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11182 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11183 LDKInitFeatures their_features_conv;
11184 their_features_conv.inner = (void*)(their_features & (~1));
11185 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
11186 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11187 their_features_conv = InitFeatures_clone(&their_features_conv);
11188 LDKOpenChannel msg_conv;
11189 msg_conv.inner = (void*)(msg & (~1));
11190 msg_conv.is_owned = false;
11191 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11192 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11195 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) {
11196 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11197 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11198 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11199 LDKPublicKey their_node_id_ref;
11200 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11201 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11202 LDKInitFeatures their_features_conv;
11203 their_features_conv.inner = (void*)(their_features & (~1));
11204 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
11205 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11206 their_features_conv = InitFeatures_clone(&their_features_conv);
11207 LDKAcceptChannel msg_conv;
11208 msg_conv.inner = (void*)(msg & (~1));
11209 msg_conv.is_owned = false;
11210 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11211 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11214 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) {
11215 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11216 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11217 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11218 LDKPublicKey their_node_id_ref;
11219 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11220 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11221 LDKFundingCreated msg_conv;
11222 msg_conv.inner = (void*)(msg & (~1));
11223 msg_conv.is_owned = false;
11224 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11225 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11228 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) {
11229 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11230 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11231 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11232 LDKPublicKey their_node_id_ref;
11233 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11234 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11235 LDKFundingSigned msg_conv;
11236 msg_conv.inner = (void*)(msg & (~1));
11237 msg_conv.is_owned = false;
11238 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11239 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11242 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) {
11243 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11244 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11245 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11246 LDKPublicKey their_node_id_ref;
11247 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11248 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11249 LDKFundingLocked msg_conv;
11250 msg_conv.inner = (void*)(msg & (~1));
11251 msg_conv.is_owned = false;
11252 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11253 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11256 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) {
11257 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11258 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11259 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11260 LDKPublicKey their_node_id_ref;
11261 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11262 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11263 LDKInitFeatures their_features_conv;
11264 their_features_conv.inner = (void*)(their_features & (~1));
11265 their_features_conv.is_owned = false;
11266 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11267 LDKShutdown msg_conv;
11268 msg_conv.inner = (void*)(msg & (~1));
11269 msg_conv.is_owned = false;
11270 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11271 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
11274 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) {
11275 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11276 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11277 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11278 LDKPublicKey their_node_id_ref;
11279 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11280 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11281 LDKClosingSigned msg_conv;
11282 msg_conv.inner = (void*)(msg & (~1));
11283 msg_conv.is_owned = false;
11284 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11285 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11288 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) {
11289 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11290 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11291 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11292 LDKPublicKey their_node_id_ref;
11293 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11294 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11295 LDKUpdateAddHTLC msg_conv;
11296 msg_conv.inner = (void*)(msg & (~1));
11297 msg_conv.is_owned = false;
11298 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11299 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11302 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) {
11303 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11304 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11305 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11306 LDKPublicKey their_node_id_ref;
11307 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11308 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11309 LDKUpdateFulfillHTLC msg_conv;
11310 msg_conv.inner = (void*)(msg & (~1));
11311 msg_conv.is_owned = false;
11312 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11313 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11316 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) {
11317 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11318 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11319 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11320 LDKPublicKey their_node_id_ref;
11321 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11322 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11323 LDKUpdateFailHTLC msg_conv;
11324 msg_conv.inner = (void*)(msg & (~1));
11325 msg_conv.is_owned = false;
11326 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11327 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11330 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) {
11331 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11332 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11333 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11334 LDKPublicKey their_node_id_ref;
11335 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11336 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11337 LDKUpdateFailMalformedHTLC msg_conv;
11338 msg_conv.inner = (void*)(msg & (~1));
11339 msg_conv.is_owned = false;
11340 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11341 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11344 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) {
11345 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11346 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11347 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11348 LDKPublicKey their_node_id_ref;
11349 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11350 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11351 LDKCommitmentSigned msg_conv;
11352 msg_conv.inner = (void*)(msg & (~1));
11353 msg_conv.is_owned = false;
11354 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11355 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11358 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) {
11359 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11360 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11361 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11362 LDKPublicKey their_node_id_ref;
11363 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11364 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11365 LDKRevokeAndACK msg_conv;
11366 msg_conv.inner = (void*)(msg & (~1));
11367 msg_conv.is_owned = false;
11368 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11369 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11372 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) {
11373 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11374 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11375 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11376 LDKPublicKey their_node_id_ref;
11377 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11378 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11379 LDKUpdateFee msg_conv;
11380 msg_conv.inner = (void*)(msg & (~1));
11381 msg_conv.is_owned = false;
11382 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11383 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11386 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) {
11387 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11388 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11389 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11390 LDKPublicKey their_node_id_ref;
11391 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11392 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11393 LDKAnnouncementSignatures msg_conv;
11394 msg_conv.inner = (void*)(msg & (~1));
11395 msg_conv.is_owned = false;
11396 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11397 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11400 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) {
11401 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11402 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11403 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11404 LDKPublicKey their_node_id_ref;
11405 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11406 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11407 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
11410 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) {
11411 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11412 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11413 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11414 LDKPublicKey their_node_id_ref;
11415 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11416 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11418 msg_conv.inner = (void*)(msg & (~1));
11419 msg_conv.is_owned = false;
11420 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11421 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11424 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) {
11425 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11426 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11427 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11428 LDKPublicKey their_node_id_ref;
11429 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11430 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11431 LDKChannelReestablish msg_conv;
11432 msg_conv.inner = (void*)(msg & (~1));
11433 msg_conv.is_owned = false;
11434 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11435 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11438 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) {
11439 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11440 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11441 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11442 LDKPublicKey their_node_id_ref;
11443 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11444 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11445 LDKChannelUpdate msg_conv;
11446 msg_conv.inner = (void*)(msg & (~1));
11447 msg_conv.is_owned = false;
11448 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11449 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11452 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) {
11453 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11454 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11455 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11456 LDKPublicKey their_node_id_ref;
11457 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11458 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11459 LDKErrorMessage msg_conv;
11460 msg_conv.inner = (void*)(msg & (~1));
11461 msg_conv.is_owned = false;
11462 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11463 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11466 typedef struct LDKRoutingMessageHandler_JCalls {
11467 atomic_size_t refcnt;
11470 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11471 jmethodID handle_node_announcement_meth;
11472 jmethodID handle_channel_announcement_meth;
11473 jmethodID handle_channel_update_meth;
11474 jmethodID get_next_channel_announcements_meth;
11475 jmethodID get_next_node_announcements_meth;
11476 jmethodID sync_routing_table_meth;
11477 jmethodID handle_reply_channel_range_meth;
11478 jmethodID handle_reply_short_channel_ids_end_meth;
11479 jmethodID handle_query_channel_range_meth;
11480 jmethodID handle_query_short_channel_ids_meth;
11481 } LDKRoutingMessageHandler_JCalls;
11482 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
11483 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11484 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11486 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11487 if (get_jenv_res == JNI_EDETACHED) {
11488 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11490 DO_ASSERT(get_jenv_res == JNI_OK);
11492 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11493 if (get_jenv_res == JNI_EDETACHED) {
11494 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11499 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
11500 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11502 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11503 if (get_jenv_res == JNI_EDETACHED) {
11504 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11506 DO_ASSERT(get_jenv_res == JNI_OK);
11508 LDKNodeAnnouncement msg_var = *msg;
11509 uintptr_t msg_ref = 0;
11510 msg_var = NodeAnnouncement_clone(msg);
11511 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11512 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11513 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11514 msg_ref = (uintptr_t)msg_var.inner;
11515 if (msg_var.is_owned) {
11518 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11519 CHECK(obj != NULL);
11520 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
11521 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11522 (*env)->ExceptionDescribe(env);
11523 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11525 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11526 CHECK_ACCESS(ret_ptr);
11527 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11529 if (get_jenv_res == JNI_EDETACHED) {
11530 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11534 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
11535 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11537 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11538 if (get_jenv_res == JNI_EDETACHED) {
11539 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11541 DO_ASSERT(get_jenv_res == JNI_OK);
11543 LDKChannelAnnouncement msg_var = *msg;
11544 uintptr_t msg_ref = 0;
11545 msg_var = ChannelAnnouncement_clone(msg);
11546 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11547 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11548 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11549 msg_ref = (uintptr_t)msg_var.inner;
11550 if (msg_var.is_owned) {
11553 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11554 CHECK(obj != NULL);
11555 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
11556 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11557 (*env)->ExceptionDescribe(env);
11558 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11560 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11561 CHECK_ACCESS(ret_ptr);
11562 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11564 if (get_jenv_res == JNI_EDETACHED) {
11565 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11569 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
11570 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11572 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11573 if (get_jenv_res == JNI_EDETACHED) {
11574 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11576 DO_ASSERT(get_jenv_res == JNI_OK);
11578 LDKChannelUpdate msg_var = *msg;
11579 uintptr_t msg_ref = 0;
11580 msg_var = ChannelUpdate_clone(msg);
11581 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11582 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11583 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11584 msg_ref = (uintptr_t)msg_var.inner;
11585 if (msg_var.is_owned) {
11588 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11589 CHECK(obj != NULL);
11590 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
11591 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11592 (*env)->ExceptionDescribe(env);
11593 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
11595 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11596 CHECK_ACCESS(ret_ptr);
11597 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11599 if (get_jenv_res == JNI_EDETACHED) {
11600 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11604 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
11605 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11607 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11608 if (get_jenv_res == JNI_EDETACHED) {
11609 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11611 DO_ASSERT(get_jenv_res == JNI_OK);
11613 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11614 CHECK(obj != NULL);
11615 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
11616 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11617 (*env)->ExceptionDescribe(env);
11618 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
11620 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
11621 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11622 if (ret_constr.datalen > 0)
11623 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11625 ret_constr.data = NULL;
11626 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11627 for (size_t h = 0; h < ret_constr.datalen; h++) {
11628 int64_t ret_conv_59 = ret_vals[h];
11629 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
11630 CHECK_ACCESS(ret_conv_59_ptr);
11631 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
11632 FREE((void*)ret_conv_59);
11633 ret_constr.data[h] = ret_conv_59_conv;
11635 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11636 if (get_jenv_res == JNI_EDETACHED) {
11637 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11641 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
11642 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11644 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11645 if (get_jenv_res == JNI_EDETACHED) {
11646 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11648 DO_ASSERT(get_jenv_res == JNI_OK);
11650 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
11651 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
11652 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11653 CHECK(obj != NULL);
11654 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
11655 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11656 (*env)->ExceptionDescribe(env);
11657 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
11659 LDKCVec_NodeAnnouncementZ ret_constr;
11660 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11661 if (ret_constr.datalen > 0)
11662 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11664 ret_constr.data = NULL;
11665 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11666 for (size_t s = 0; s < ret_constr.datalen; s++) {
11667 int64_t ret_conv_18 = ret_vals[s];
11668 LDKNodeAnnouncement ret_conv_18_conv;
11669 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
11670 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
11671 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
11672 ret_constr.data[s] = ret_conv_18_conv;
11674 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11675 if (get_jenv_res == JNI_EDETACHED) {
11676 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11680 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
11681 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11683 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11684 if (get_jenv_res == JNI_EDETACHED) {
11685 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11687 DO_ASSERT(get_jenv_res == JNI_OK);
11689 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11690 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11691 LDKInit init_var = *init;
11692 uintptr_t init_ref = 0;
11693 init_var = Init_clone(init);
11694 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11695 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11696 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
11697 init_ref = (uintptr_t)init_var.inner;
11698 if (init_var.is_owned) {
11701 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11702 CHECK(obj != NULL);
11703 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
11704 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11705 (*env)->ExceptionDescribe(env);
11706 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
11708 if (get_jenv_res == JNI_EDETACHED) {
11709 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11712 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
11713 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11715 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11716 if (get_jenv_res == JNI_EDETACHED) {
11717 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11719 DO_ASSERT(get_jenv_res == JNI_OK);
11721 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11722 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11723 LDKReplyChannelRange msg_var = msg;
11724 uintptr_t msg_ref = 0;
11725 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11726 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11727 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11728 msg_ref = (uintptr_t)msg_var.inner;
11729 if (msg_var.is_owned) {
11732 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11733 CHECK(obj != NULL);
11734 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
11735 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11736 (*env)->ExceptionDescribe(env);
11737 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
11739 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11740 CHECK_ACCESS(ret_ptr);
11741 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11743 if (get_jenv_res == JNI_EDETACHED) {
11744 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11748 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
11749 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11751 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11752 if (get_jenv_res == JNI_EDETACHED) {
11753 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11755 DO_ASSERT(get_jenv_res == JNI_OK);
11757 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11758 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11759 LDKReplyShortChannelIdsEnd msg_var = msg;
11760 uintptr_t msg_ref = 0;
11761 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11762 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11763 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11764 msg_ref = (uintptr_t)msg_var.inner;
11765 if (msg_var.is_owned) {
11768 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11769 CHECK(obj != NULL);
11770 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
11771 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11772 (*env)->ExceptionDescribe(env);
11773 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
11775 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11776 CHECK_ACCESS(ret_ptr);
11777 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11779 if (get_jenv_res == JNI_EDETACHED) {
11780 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11784 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
11785 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11787 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11788 if (get_jenv_res == JNI_EDETACHED) {
11789 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11791 DO_ASSERT(get_jenv_res == JNI_OK);
11793 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11794 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11795 LDKQueryChannelRange msg_var = msg;
11796 uintptr_t msg_ref = 0;
11797 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11798 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11799 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11800 msg_ref = (uintptr_t)msg_var.inner;
11801 if (msg_var.is_owned) {
11804 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11805 CHECK(obj != NULL);
11806 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
11807 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11808 (*env)->ExceptionDescribe(env);
11809 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
11811 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11812 CHECK_ACCESS(ret_ptr);
11813 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11815 if (get_jenv_res == JNI_EDETACHED) {
11816 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11820 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
11821 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11823 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11824 if (get_jenv_res == JNI_EDETACHED) {
11825 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11827 DO_ASSERT(get_jenv_res == JNI_OK);
11829 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11830 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11831 LDKQueryShortChannelIds msg_var = msg;
11832 uintptr_t msg_ref = 0;
11833 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11834 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11835 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11836 msg_ref = (uintptr_t)msg_var.inner;
11837 if (msg_var.is_owned) {
11840 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11841 CHECK(obj != NULL);
11842 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
11843 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11844 (*env)->ExceptionDescribe(env);
11845 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
11847 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11848 CHECK_ACCESS(ret_ptr);
11849 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11851 if (get_jenv_res == JNI_EDETACHED) {
11852 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11856 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
11857 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
11858 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11859 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11861 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11862 jclass c = (*env)->GetObjectClass(env, o);
11864 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
11865 atomic_init(&calls->refcnt, 1);
11866 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11867 calls->o = (*env)->NewWeakGlobalRef(env, o);
11868 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
11869 CHECK(calls->handle_node_announcement_meth != NULL);
11870 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
11871 CHECK(calls->handle_channel_announcement_meth != NULL);
11872 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
11873 CHECK(calls->handle_channel_update_meth != NULL);
11874 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
11875 CHECK(calls->get_next_channel_announcements_meth != NULL);
11876 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
11877 CHECK(calls->get_next_node_announcements_meth != NULL);
11878 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
11879 CHECK(calls->sync_routing_table_meth != NULL);
11880 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
11881 CHECK(calls->handle_reply_channel_range_meth != NULL);
11882 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
11883 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
11884 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
11885 CHECK(calls->handle_query_channel_range_meth != NULL);
11886 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
11887 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
11889 LDKRoutingMessageHandler ret = {
11890 .this_arg = (void*) calls,
11891 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
11892 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
11893 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
11894 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
11895 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
11896 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
11897 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
11898 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
11899 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
11900 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
11901 .free = LDKRoutingMessageHandler_JCalls_free,
11902 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
11904 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
11907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11908 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
11909 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
11910 return (uint64_t)res_ptr;
11912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
11913 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
11914 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
11915 DO_ASSERT((res_ptr & 1) == 0);
11916 return (int64_t)(res_ptr | 1);
11918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
11919 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11920 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11921 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11922 LDKNodeAnnouncement msg_conv;
11923 msg_conv.inner = (void*)(msg & (~1));
11924 msg_conv.is_owned = false;
11925 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11926 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11927 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
11928 return (uintptr_t)ret_conv;
11931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
11932 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11933 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11934 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11935 LDKChannelAnnouncement msg_conv;
11936 msg_conv.inner = (void*)(msg & (~1));
11937 msg_conv.is_owned = false;
11938 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11939 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11940 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
11941 return (uintptr_t)ret_conv;
11944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
11945 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11946 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11947 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11948 LDKChannelUpdate msg_conv;
11949 msg_conv.inner = (void*)(msg & (~1));
11950 msg_conv.is_owned = false;
11951 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11952 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11953 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
11954 return (uintptr_t)ret_conv;
11957 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) {
11958 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11959 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11960 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11961 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
11962 int64_tArray ret_arr = NULL;
11963 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11964 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11965 for (size_t h = 0; h < ret_var.datalen; h++) {
11966 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11967 *ret_conv_59_conv = ret_var.data[h];
11968 ret_arr_ptr[h] = ((uintptr_t)ret_conv_59_conv);
11970 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11971 FREE(ret_var.data);
11975 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) {
11976 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11977 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11978 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11979 LDKPublicKey starting_point_ref;
11980 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
11981 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
11982 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
11983 int64_tArray ret_arr = NULL;
11984 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11985 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11986 for (size_t s = 0; s < ret_var.datalen; s++) {
11987 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
11988 uintptr_t ret_conv_18_ref = 0;
11989 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11990 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
11992 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
11993 if (ret_conv_18_var.is_owned) {
11994 ret_conv_18_ref |= 1;
11996 ret_arr_ptr[s] = ret_conv_18_ref;
11998 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11999 FREE(ret_var.data);
12003 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) {
12004 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12005 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12006 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12007 LDKPublicKey their_node_id_ref;
12008 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12009 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12011 init_conv.inner = (void*)(init & (~1));
12012 init_conv.is_owned = false;
12013 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
12014 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
12017 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) {
12018 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12019 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12020 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12021 LDKPublicKey their_node_id_ref;
12022 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12023 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12024 LDKReplyChannelRange msg_conv;
12025 msg_conv.inner = (void*)(msg & (~1));
12026 msg_conv.is_owned = (msg & 1) || (msg == 0);
12027 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12028 msg_conv = ReplyChannelRange_clone(&msg_conv);
12029 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12030 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12031 return (uintptr_t)ret_conv;
12034 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) {
12035 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12036 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12037 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12038 LDKPublicKey their_node_id_ref;
12039 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12040 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12041 LDKReplyShortChannelIdsEnd msg_conv;
12042 msg_conv.inner = (void*)(msg & (~1));
12043 msg_conv.is_owned = (msg & 1) || (msg == 0);
12044 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12045 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
12046 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12047 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12048 return (uintptr_t)ret_conv;
12051 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) {
12052 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12053 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12054 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12055 LDKPublicKey their_node_id_ref;
12056 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12057 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12058 LDKQueryChannelRange msg_conv;
12059 msg_conv.inner = (void*)(msg & (~1));
12060 msg_conv.is_owned = (msg & 1) || (msg == 0);
12061 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12062 msg_conv = QueryChannelRange_clone(&msg_conv);
12063 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12064 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12065 return (uintptr_t)ret_conv;
12068 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) {
12069 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12070 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12071 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12072 LDKPublicKey their_node_id_ref;
12073 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12074 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12075 LDKQueryShortChannelIds msg_conv;
12076 msg_conv.inner = (void*)(msg & (~1));
12077 msg_conv.is_owned = (msg & 1) || (msg == 0);
12078 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12079 msg_conv = QueryShortChannelIds_clone(&msg_conv);
12080 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12081 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12082 return (uintptr_t)ret_conv;
12085 typedef struct LDKCustomMessageReader_JCalls {
12086 atomic_size_t refcnt;
12089 jmethodID read_meth;
12090 } LDKCustomMessageReader_JCalls;
12091 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
12092 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12093 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12095 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12096 if (get_jenv_res == JNI_EDETACHED) {
12097 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12099 DO_ASSERT(get_jenv_res == JNI_OK);
12101 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12102 if (get_jenv_res == JNI_EDETACHED) {
12103 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12108 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
12109 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12111 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12112 if (get_jenv_res == JNI_EDETACHED) {
12113 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12115 DO_ASSERT(get_jenv_res == JNI_OK);
12117 LDKu8slice buffer_var = buffer;
12118 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
12119 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
12120 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12121 CHECK(obj != NULL);
12122 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
12123 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12124 (*env)->ExceptionDescribe(env);
12125 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
12127 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12128 CHECK_ACCESS(ret_ptr);
12129 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
12131 if (get_jenv_res == JNI_EDETACHED) {
12132 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12136 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
12137 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
12138 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12140 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
12141 jclass c = (*env)->GetObjectClass(env, o);
12143 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
12144 atomic_init(&calls->refcnt, 1);
12145 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12146 calls->o = (*env)->NewWeakGlobalRef(env, o);
12147 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
12148 CHECK(calls->read_meth != NULL);
12150 LDKCustomMessageReader ret = {
12151 .this_arg = (void*) calls,
12152 .read = read_LDKCustomMessageReader_jcall,
12153 .free = LDKCustomMessageReader_JCalls_free,
12157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
12158 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
12159 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
12160 return (uint64_t)res_ptr;
12162 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) {
12163 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12164 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12165 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
12166 LDKu8slice buffer_ref;
12167 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
12168 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
12169 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12170 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
12171 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
12172 return (uintptr_t)ret_conv;
12175 typedef struct LDKCustomMessageHandler_JCalls {
12176 atomic_size_t refcnt;
12179 LDKCustomMessageReader_JCalls* CustomMessageReader;
12180 jmethodID handle_custom_message_meth;
12181 jmethodID get_and_clear_pending_msg_meth;
12182 } LDKCustomMessageHandler_JCalls;
12183 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
12184 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12185 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12187 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12188 if (get_jenv_res == JNI_EDETACHED) {
12189 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12191 DO_ASSERT(get_jenv_res == JNI_OK);
12193 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12194 if (get_jenv_res == JNI_EDETACHED) {
12195 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12200 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
12201 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12203 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12204 if (get_jenv_res == JNI_EDETACHED) {
12205 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12207 DO_ASSERT(get_jenv_res == JNI_OK);
12209 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
12211 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
12212 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
12213 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12214 CHECK(obj != NULL);
12215 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uintptr_t)msg_ret, sender_node_id_arr);
12216 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12217 (*env)->ExceptionDescribe(env);
12218 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
12220 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12221 CHECK_ACCESS(ret_ptr);
12222 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12224 if (get_jenv_res == JNI_EDETACHED) {
12225 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12229 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
12230 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12232 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12233 if (get_jenv_res == JNI_EDETACHED) {
12234 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12236 DO_ASSERT(get_jenv_res == JNI_OK);
12238 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12239 CHECK(obj != NULL);
12240 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
12241 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12242 (*env)->ExceptionDescribe(env);
12243 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
12245 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
12246 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12247 if (ret_constr.datalen > 0)
12248 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
12250 ret_constr.data = NULL;
12251 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12252 for (size_t z = 0; z < ret_constr.datalen; z++) {
12253 int64_t ret_conv_25 = ret_vals[z];
12254 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
12255 CHECK_ACCESS(ret_conv_25_ptr);
12256 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
12257 FREE((void*)ret_conv_25);
12258 ret_constr.data[z] = ret_conv_25_conv;
12260 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12261 if (get_jenv_res == JNI_EDETACHED) {
12262 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12266 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
12267 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
12268 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12269 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
12271 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12272 jclass c = (*env)->GetObjectClass(env, o);
12274 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
12275 atomic_init(&calls->refcnt, 1);
12276 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12277 calls->o = (*env)->NewWeakGlobalRef(env, o);
12278 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
12279 CHECK(calls->handle_custom_message_meth != NULL);
12280 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
12281 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
12283 LDKCustomMessageHandler ret = {
12284 .this_arg = (void*) calls,
12285 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
12286 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
12287 .free = LDKCustomMessageHandler_JCalls_free,
12288 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
12290 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
12293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12294 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
12295 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
12296 return (uint64_t)res_ptr;
12298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
12299 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
12300 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
12301 DO_ASSERT((res_ptr & 1) == 0);
12302 return (int64_t)(res_ptr | 1);
12304 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) {
12305 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12306 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12307 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12308 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
12309 CHECK_ACCESS(msg_ptr);
12310 LDKType msg_conv = *(LDKType*)(msg_ptr);
12311 if (msg_conv.free == LDKType_JCalls_free) {
12312 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12313 LDKType_JCalls_cloned(&msg_conv);
12315 LDKPublicKey sender_node_id_ref;
12316 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
12317 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
12318 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12319 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
12320 return (uintptr_t)ret_conv;
12323 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
12324 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12325 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12326 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12327 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
12328 int64_tArray ret_arr = NULL;
12329 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12330 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12331 for (size_t z = 0; z < ret_var.datalen; z++) {
12332 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12333 *ret_conv_25_conv = ret_var.data[z];
12334 ret_arr_ptr[z] = ((uintptr_t)ret_conv_25_conv);
12336 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12337 FREE(ret_var.data);
12341 typedef struct LDKSocketDescriptor_JCalls {
12342 atomic_size_t refcnt;
12345 jmethodID send_data_meth;
12346 jmethodID disconnect_socket_meth;
12348 jmethodID hash_meth;
12349 } LDKSocketDescriptor_JCalls;
12350 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
12351 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12352 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12361 if (get_jenv_res == JNI_EDETACHED) {
12362 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12367 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
12368 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12370 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12371 if (get_jenv_res == JNI_EDETACHED) {
12372 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12374 DO_ASSERT(get_jenv_res == JNI_OK);
12376 LDKu8slice data_var = data;
12377 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
12378 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
12379 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12380 CHECK(obj != NULL);
12381 intptr_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
12382 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12383 (*env)->ExceptionDescribe(env);
12384 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
12386 if (get_jenv_res == JNI_EDETACHED) {
12387 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12391 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
12392 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12394 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12395 if (get_jenv_res == JNI_EDETACHED) {
12396 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12398 DO_ASSERT(get_jenv_res == JNI_OK);
12400 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12401 CHECK(obj != NULL);
12402 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
12403 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12404 (*env)->ExceptionDescribe(env);
12405 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
12407 if (get_jenv_res == JNI_EDETACHED) {
12408 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12411 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
12412 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12414 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12415 if (get_jenv_res == JNI_EDETACHED) {
12416 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12418 DO_ASSERT(get_jenv_res == JNI_OK);
12420 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12421 *other_arg_clone = SocketDescriptor_clone(other_arg);
12422 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12423 CHECK(obj != NULL);
12424 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uintptr_t)other_arg_clone);
12425 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12426 (*env)->ExceptionDescribe(env);
12427 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
12429 if (get_jenv_res == JNI_EDETACHED) {
12430 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12434 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
12435 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12437 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12438 if (get_jenv_res == JNI_EDETACHED) {
12439 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12441 DO_ASSERT(get_jenv_res == JNI_OK);
12443 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12444 CHECK(obj != NULL);
12445 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
12446 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12447 (*env)->ExceptionDescribe(env);
12448 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
12450 if (get_jenv_res == JNI_EDETACHED) {
12451 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12455 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
12456 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
12457 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12459 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
12460 jclass c = (*env)->GetObjectClass(env, o);
12462 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
12463 atomic_init(&calls->refcnt, 1);
12464 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12465 calls->o = (*env)->NewWeakGlobalRef(env, o);
12466 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
12467 CHECK(calls->send_data_meth != NULL);
12468 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
12469 CHECK(calls->disconnect_socket_meth != NULL);
12470 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
12471 CHECK(calls->eq_meth != NULL);
12472 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
12473 CHECK(calls->hash_meth != NULL);
12475 LDKSocketDescriptor ret = {
12476 .this_arg = (void*) calls,
12477 .send_data = send_data_LDKSocketDescriptor_jcall,
12478 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
12479 .eq = eq_LDKSocketDescriptor_jcall,
12480 .hash = hash_LDKSocketDescriptor_jcall,
12481 .cloned = LDKSocketDescriptor_JCalls_cloned,
12482 .free = LDKSocketDescriptor_JCalls_free,
12486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
12487 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12488 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
12489 return (uint64_t)res_ptr;
12491 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) {
12492 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12493 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12494 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12495 LDKu8slice data_ref;
12496 data_ref.datalen = (*env)->GetArrayLength(env, data);
12497 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
12498 intptr_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
12499 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
12503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
12504 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12505 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12506 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12507 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
12510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
12511 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12512 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12513 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12514 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
12518 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
12519 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
12520 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
12521 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
12522 static jclass LDKEffectiveCapacity_Total_class = NULL;
12523 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
12524 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
12525 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
12526 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
12527 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
12528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
12529 LDKEffectiveCapacity_ExactLiquidity_class =
12530 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
12531 CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
12532 LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
12533 CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
12534 LDKEffectiveCapacity_MaximumHTLC_class =
12535 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
12536 CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
12537 LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
12538 CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
12539 LDKEffectiveCapacity_Total_class =
12540 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
12541 CHECK(LDKEffectiveCapacity_Total_class != NULL);
12542 LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(J)V");
12543 CHECK(LDKEffectiveCapacity_Total_meth != NULL);
12544 LDKEffectiveCapacity_Infinite_class =
12545 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
12546 CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
12547 LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
12548 CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
12549 LDKEffectiveCapacity_Unknown_class =
12550 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
12551 CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
12552 LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
12553 CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
12555 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12556 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
12558 case LDKEffectiveCapacity_ExactLiquidity: {
12559 return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, obj->exact_liquidity.liquidity_msat);
12561 case LDKEffectiveCapacity_MaximumHTLC: {
12562 return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, obj->maximum_htlc.amount_msat);
12564 case LDKEffectiveCapacity_Total: {
12565 return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, obj->total.capacity_msat);
12567 case LDKEffectiveCapacity_Infinite: {
12568 return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
12570 case LDKEffectiveCapacity_Unknown: {
12571 return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
12576 typedef struct LDKScore_JCalls {
12577 atomic_size_t refcnt;
12580 jmethodID channel_penalty_msat_meth;
12581 jmethodID payment_path_failed_meth;
12582 jmethodID payment_path_successful_meth;
12583 jmethodID write_meth;
12585 static void LDKScore_JCalls_free(void* this_arg) {
12586 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12587 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12596 if (get_jenv_res == JNI_EDETACHED) {
12597 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12602 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const LDKNodeId * source, const LDKNodeId * target) {
12603 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12605 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12606 if (get_jenv_res == JNI_EDETACHED) {
12607 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12609 DO_ASSERT(get_jenv_res == JNI_OK);
12611 LDKNodeId source_var = *source;
12612 uintptr_t source_ref = 0;
12613 source_var = NodeId_clone(source);
12614 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12615 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12616 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
12617 source_ref = (uintptr_t)source_var.inner;
12618 if (source_var.is_owned) {
12621 LDKNodeId target_var = *target;
12622 uintptr_t target_ref = 0;
12623 target_var = NodeId_clone(target);
12624 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12625 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12626 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
12627 target_ref = (uintptr_t)target_var.inner;
12628 if (target_var.is_owned) {
12631 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12632 CHECK(obj != NULL);
12633 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, capacity_msat, source_ref, target_ref);
12634 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12635 (*env)->ExceptionDescribe(env);
12636 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
12638 if (get_jenv_res == JNI_EDETACHED) {
12639 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12643 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
12644 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12646 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12647 if (get_jenv_res == JNI_EDETACHED) {
12648 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12650 DO_ASSERT(get_jenv_res == JNI_OK);
12652 LDKCVec_RouteHopZ path_var = path;
12653 int64_tArray path_arr = NULL;
12654 path_arr = (*env)->NewLongArray(env, path_var.datalen);
12655 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
12656 for (size_t k = 0; k < path_var.datalen; k++) {
12657 LDKRouteHop path_conv_10_var = path_var.data[k];
12658 uintptr_t path_conv_10_ref = 0;
12659 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12660 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12661 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
12662 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
12663 if (path_conv_10_var.is_owned) {
12664 path_conv_10_ref |= 1;
12666 path_arr_ptr[k] = path_conv_10_ref;
12668 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
12669 FREE(path_var.data);
12670 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12671 CHECK(obj != NULL);
12672 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id);
12673 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12674 (*env)->ExceptionDescribe(env);
12675 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
12677 if (get_jenv_res == JNI_EDETACHED) {
12678 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12681 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
12682 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12684 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12685 if (get_jenv_res == JNI_EDETACHED) {
12686 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12688 DO_ASSERT(get_jenv_res == JNI_OK);
12690 LDKCVec_RouteHopZ path_var = path;
12691 int64_tArray path_arr = NULL;
12692 path_arr = (*env)->NewLongArray(env, path_var.datalen);
12693 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
12694 for (size_t k = 0; k < path_var.datalen; k++) {
12695 LDKRouteHop path_conv_10_var = path_var.data[k];
12696 uintptr_t path_conv_10_ref = 0;
12697 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12698 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12699 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
12700 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
12701 if (path_conv_10_var.is_owned) {
12702 path_conv_10_ref |= 1;
12704 path_arr_ptr[k] = path_conv_10_ref;
12706 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
12707 FREE(path_var.data);
12708 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12709 CHECK(obj != NULL);
12710 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
12711 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12712 (*env)->ExceptionDescribe(env);
12713 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
12715 if (get_jenv_res == JNI_EDETACHED) {
12716 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12719 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
12720 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12722 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12723 if (get_jenv_res == JNI_EDETACHED) {
12724 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12726 DO_ASSERT(get_jenv_res == JNI_OK);
12728 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12729 CHECK(obj != NULL);
12730 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
12731 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12732 (*env)->ExceptionDescribe(env);
12733 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
12735 LDKCVec_u8Z ret_ref;
12736 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
12737 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
12738 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
12739 if (get_jenv_res == JNI_EDETACHED) {
12740 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12744 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
12745 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
12746 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12748 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
12749 jclass c = (*env)->GetObjectClass(env, o);
12751 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
12752 atomic_init(&calls->refcnt, 1);
12753 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12754 calls->o = (*env)->NewWeakGlobalRef(env, o);
12755 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
12756 CHECK(calls->channel_penalty_msat_meth != NULL);
12757 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
12758 CHECK(calls->payment_path_failed_meth != NULL);
12759 calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
12760 CHECK(calls->payment_path_successful_meth != NULL);
12761 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
12762 CHECK(calls->write_meth != NULL);
12765 .this_arg = (void*) calls,
12766 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
12767 .payment_path_failed = payment_path_failed_LDKScore_jcall,
12768 .payment_path_successful = payment_path_successful_LDKScore_jcall,
12769 .write = write_LDKScore_jcall,
12770 .free = LDKScore_JCalls_free,
12774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
12775 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
12776 *res_ptr = LDKScore_init(env, clz, o);
12777 return (uint64_t)res_ptr;
12779 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 capacity_msat, int64_t source, int64_t target) {
12780 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12781 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12782 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12783 LDKNodeId source_conv;
12784 source_conv.inner = (void*)(source & (~1));
12785 source_conv.is_owned = false;
12786 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
12787 LDKNodeId target_conv;
12788 target_conv.inner = (void*)(target & (~1));
12789 target_conv.is_owned = false;
12790 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
12791 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, capacity_msat, &source_conv, &target_conv);
12795 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) {
12796 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12797 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12798 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12799 LDKCVec_RouteHopZ path_constr;
12800 path_constr.datalen = (*env)->GetArrayLength(env, path);
12801 if (path_constr.datalen > 0)
12802 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12804 path_constr.data = NULL;
12805 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
12806 for (size_t k = 0; k < path_constr.datalen; k++) {
12807 int64_t path_conv_10 = path_vals[k];
12808 LDKRouteHop path_conv_10_conv;
12809 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
12810 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
12811 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
12812 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
12813 path_constr.data[k] = path_conv_10_conv;
12815 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
12816 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
12819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
12820 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12821 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12822 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12823 LDKCVec_RouteHopZ path_constr;
12824 path_constr.datalen = (*env)->GetArrayLength(env, path);
12825 if (path_constr.datalen > 0)
12826 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12828 path_constr.data = NULL;
12829 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
12830 for (size_t k = 0; k < path_constr.datalen; k++) {
12831 int64_t path_conv_10 = path_vals[k];
12832 LDKRouteHop path_conv_10_conv;
12833 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
12834 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
12835 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
12836 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
12837 path_constr.data[k] = path_conv_10_conv;
12839 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
12840 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
12843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
12844 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12845 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12846 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12847 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
12848 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12849 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12850 CVec_u8Z_free(ret_var);
12854 typedef struct LDKLockableScore_JCalls {
12855 atomic_size_t refcnt;
12858 jmethodID lock_meth;
12859 } LDKLockableScore_JCalls;
12860 static void LDKLockableScore_JCalls_free(void* this_arg) {
12861 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12862 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12864 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12865 if (get_jenv_res == JNI_EDETACHED) {
12866 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12868 DO_ASSERT(get_jenv_res == JNI_OK);
12870 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12871 if (get_jenv_res == JNI_EDETACHED) {
12872 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12877 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
12878 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12880 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12881 if (get_jenv_res == JNI_EDETACHED) {
12882 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12884 DO_ASSERT(get_jenv_res == JNI_OK);
12886 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12887 CHECK(obj != NULL);
12888 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
12889 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12890 (*env)->ExceptionDescribe(env);
12891 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
12893 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12894 CHECK_ACCESS(ret_ptr);
12895 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
12896 if (ret_conv.free == LDKScore_JCalls_free) {
12897 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12898 LDKScore_JCalls_cloned(&ret_conv);
12899 }// WARNING: we may need a move here but no clone is available for LDKScore
12901 if (get_jenv_res == JNI_EDETACHED) {
12902 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12906 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
12907 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
12908 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12910 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
12911 jclass c = (*env)->GetObjectClass(env, o);
12913 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
12914 atomic_init(&calls->refcnt, 1);
12915 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12916 calls->o = (*env)->NewWeakGlobalRef(env, o);
12917 calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
12918 CHECK(calls->lock_meth != NULL);
12920 LDKLockableScore ret = {
12921 .this_arg = (void*) calls,
12922 .lock = lock_LDKLockableScore_jcall,
12923 .free = LDKLockableScore_JCalls_free,
12927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
12928 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
12929 *res_ptr = LDKLockableScore_init(env, clz, o);
12930 return (uint64_t)res_ptr;
12932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
12933 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12934 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12935 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
12936 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
12937 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
12938 return (uintptr_t)ret_ret;
12941 typedef struct LDKChannelManagerPersister_JCalls {
12942 atomic_size_t refcnt;
12945 jmethodID persist_manager_meth;
12946 } LDKChannelManagerPersister_JCalls;
12947 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
12948 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
12949 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12951 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12952 if (get_jenv_res == JNI_EDETACHED) {
12953 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12955 DO_ASSERT(get_jenv_res == JNI_OK);
12957 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12958 if (get_jenv_res == JNI_EDETACHED) {
12959 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12964 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
12965 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
12967 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12968 if (get_jenv_res == JNI_EDETACHED) {
12969 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12971 DO_ASSERT(get_jenv_res == JNI_OK);
12973 LDKChannelManager channel_manager_var = *channel_manager;
12974 uintptr_t channel_manager_ref = 0;
12975 // WARNING: we may need a move here but no clone is available for LDKChannelManager
12976 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12977 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12978 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
12979 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
12980 if (channel_manager_var.is_owned) {
12981 channel_manager_ref |= 1;
12983 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12984 CHECK(obj != NULL);
12985 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
12986 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12987 (*env)->ExceptionDescribe(env);
12988 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
12990 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12991 CHECK_ACCESS(ret_ptr);
12992 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
12994 if (get_jenv_res == JNI_EDETACHED) {
12995 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12999 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
13000 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
13001 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13003 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
13004 jclass c = (*env)->GetObjectClass(env, o);
13006 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
13007 atomic_init(&calls->refcnt, 1);
13008 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13009 calls->o = (*env)->NewWeakGlobalRef(env, o);
13010 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
13011 CHECK(calls->persist_manager_meth != NULL);
13013 LDKChannelManagerPersister ret = {
13014 .this_arg = (void*) calls,
13015 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
13016 .free = LDKChannelManagerPersister_JCalls_free,
13020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
13021 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
13022 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
13023 return (uint64_t)res_ptr;
13025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
13026 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13027 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13028 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
13029 LDKChannelManager channel_manager_conv;
13030 channel_manager_conv.inner = (void*)(channel_manager & (~1));
13031 channel_manager_conv.is_owned = false;
13032 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
13033 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
13034 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
13035 return (uintptr_t)ret_conv;
13038 static jclass LDKFallback_SegWitProgram_class = NULL;
13039 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
13040 static jclass LDKFallback_PubKeyHash_class = NULL;
13041 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
13042 static jclass LDKFallback_ScriptHash_class = NULL;
13043 static jmethodID LDKFallback_ScriptHash_meth = NULL;
13044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
13045 LDKFallback_SegWitProgram_class =
13046 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
13047 CHECK(LDKFallback_SegWitProgram_class != NULL);
13048 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
13049 CHECK(LDKFallback_SegWitProgram_meth != NULL);
13050 LDKFallback_PubKeyHash_class =
13051 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
13052 CHECK(LDKFallback_PubKeyHash_class != NULL);
13053 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
13054 CHECK(LDKFallback_PubKeyHash_meth != NULL);
13055 LDKFallback_ScriptHash_class =
13056 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
13057 CHECK(LDKFallback_ScriptHash_class != NULL);
13058 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
13059 CHECK(LDKFallback_ScriptHash_meth != NULL);
13061 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13062 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
13064 case LDKFallback_SegWitProgram: {
13065 uint8_t version_val = obj->seg_wit_program.version._0;
13066 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
13067 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
13068 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
13069 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
13071 case LDKFallback_PubKeyHash: {
13072 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
13073 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
13074 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
13076 case LDKFallback_ScriptHash: {
13077 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
13078 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
13079 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
13084 typedef struct LDKPayer_JCalls {
13085 atomic_size_t refcnt;
13088 jmethodID node_id_meth;
13089 jmethodID first_hops_meth;
13090 jmethodID send_payment_meth;
13091 jmethodID send_spontaneous_payment_meth;
13092 jmethodID retry_payment_meth;
13093 jmethodID abandon_payment_meth;
13095 static void LDKPayer_JCalls_free(void* this_arg) {
13096 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13097 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13099 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13100 if (get_jenv_res == JNI_EDETACHED) {
13101 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13103 DO_ASSERT(get_jenv_res == JNI_OK);
13105 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13106 if (get_jenv_res == JNI_EDETACHED) {
13107 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13112 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
13113 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13115 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13116 if (get_jenv_res == JNI_EDETACHED) {
13117 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13119 DO_ASSERT(get_jenv_res == JNI_OK);
13121 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13122 CHECK(obj != NULL);
13123 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
13124 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13125 (*env)->ExceptionDescribe(env);
13126 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
13128 LDKPublicKey ret_ref;
13129 CHECK((*env)->GetArrayLength(env, ret) == 33);
13130 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
13131 if (get_jenv_res == JNI_EDETACHED) {
13132 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13136 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
13137 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13139 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13140 if (get_jenv_res == JNI_EDETACHED) {
13141 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13143 DO_ASSERT(get_jenv_res == JNI_OK);
13145 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13146 CHECK(obj != NULL);
13147 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
13148 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13149 (*env)->ExceptionDescribe(env);
13150 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
13152 LDKCVec_ChannelDetailsZ ret_constr;
13153 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13154 if (ret_constr.datalen > 0)
13155 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13157 ret_constr.data = NULL;
13158 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13159 for (size_t q = 0; q < ret_constr.datalen; q++) {
13160 int64_t ret_conv_16 = ret_vals[q];
13161 LDKChannelDetails ret_conv_16_conv;
13162 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
13163 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
13164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
13165 ret_constr.data[q] = ret_conv_16_conv;
13167 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13168 if (get_jenv_res == JNI_EDETACHED) {
13169 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13173 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
13174 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13176 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13177 if (get_jenv_res == JNI_EDETACHED) {
13178 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13180 DO_ASSERT(get_jenv_res == JNI_OK);
13182 LDKRoute route_var = *route;
13183 uintptr_t route_ref = 0;
13184 route_var = Route_clone(route);
13185 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13186 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13187 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13188 route_ref = (uintptr_t)route_var.inner;
13189 if (route_var.is_owned) {
13192 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13193 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
13194 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
13195 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
13196 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13197 CHECK(obj != NULL);
13198 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
13199 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13200 (*env)->ExceptionDescribe(env);
13201 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
13203 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13204 CHECK_ACCESS(ret_ptr);
13205 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13207 if (get_jenv_res == JNI_EDETACHED) {
13208 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13212 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
13213 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13215 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13216 if (get_jenv_res == JNI_EDETACHED) {
13217 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13219 DO_ASSERT(get_jenv_res == JNI_OK);
13221 LDKRoute route_var = *route;
13222 uintptr_t route_ref = 0;
13223 route_var = Route_clone(route);
13224 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13225 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13226 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13227 route_ref = (uintptr_t)route_var.inner;
13228 if (route_var.is_owned) {
13231 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
13232 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
13233 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13234 CHECK(obj != NULL);
13235 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
13236 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13237 (*env)->ExceptionDescribe(env);
13238 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
13240 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13241 CHECK_ACCESS(ret_ptr);
13242 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13244 if (get_jenv_res == JNI_EDETACHED) {
13245 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13249 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
13250 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13252 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13253 if (get_jenv_res == JNI_EDETACHED) {
13254 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13256 DO_ASSERT(get_jenv_res == JNI_OK);
13258 LDKRoute route_var = *route;
13259 uintptr_t route_ref = 0;
13260 route_var = Route_clone(route);
13261 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13262 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13263 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13264 route_ref = (uintptr_t)route_var.inner;
13265 if (route_var.is_owned) {
13268 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13269 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13270 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13271 CHECK(obj != NULL);
13272 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
13273 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13274 (*env)->ExceptionDescribe(env);
13275 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
13277 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13278 CHECK_ACCESS(ret_ptr);
13279 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
13281 if (get_jenv_res == JNI_EDETACHED) {
13282 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13286 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
13287 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13289 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13290 if (get_jenv_res == JNI_EDETACHED) {
13291 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13293 DO_ASSERT(get_jenv_res == JNI_OK);
13295 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13296 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13297 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13298 CHECK(obj != NULL);
13299 (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
13300 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13301 (*env)->ExceptionDescribe(env);
13302 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
13304 if (get_jenv_res == JNI_EDETACHED) {
13305 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13308 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
13309 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
13310 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13312 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
13313 jclass c = (*env)->GetObjectClass(env, o);
13315 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
13316 atomic_init(&calls->refcnt, 1);
13317 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13318 calls->o = (*env)->NewWeakGlobalRef(env, o);
13319 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
13320 CHECK(calls->node_id_meth != NULL);
13321 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
13322 CHECK(calls->first_hops_meth != NULL);
13323 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
13324 CHECK(calls->send_payment_meth != NULL);
13325 calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
13326 CHECK(calls->send_spontaneous_payment_meth != NULL);
13327 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
13328 CHECK(calls->retry_payment_meth != NULL);
13329 calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
13330 CHECK(calls->abandon_payment_meth != NULL);
13333 .this_arg = (void*) calls,
13334 .node_id = node_id_LDKPayer_jcall,
13335 .first_hops = first_hops_LDKPayer_jcall,
13336 .send_payment = send_payment_LDKPayer_jcall,
13337 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
13338 .retry_payment = retry_payment_LDKPayer_jcall,
13339 .abandon_payment = abandon_payment_LDKPayer_jcall,
13340 .free = LDKPayer_JCalls_free,
13344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
13345 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
13346 *res_ptr = LDKPayer_init(env, clz, o);
13347 return (uint64_t)res_ptr;
13349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13350 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13351 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13352 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13353 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13354 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
13358 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
13359 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13360 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13361 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13362 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
13363 int64_tArray ret_arr = NULL;
13364 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13365 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13366 for (size_t q = 0; q < ret_var.datalen; q++) {
13367 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
13368 uintptr_t ret_conv_16_ref = 0;
13369 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13370 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
13372 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
13373 if (ret_conv_16_var.is_owned) {
13374 ret_conv_16_ref |= 1;
13376 ret_arr_ptr[q] = ret_conv_16_ref;
13378 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13379 FREE(ret_var.data);
13383 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) {
13384 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13385 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13386 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13387 LDKRoute route_conv;
13388 route_conv.inner = (void*)(route & (~1));
13389 route_conv.is_owned = false;
13390 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13391 LDKThirtyTwoBytes payment_hash_ref;
13392 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13393 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13394 LDKThirtyTwoBytes payment_secret_ref;
13395 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
13396 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
13397 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13398 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
13399 return (uintptr_t)ret_conv;
13402 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) {
13403 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13404 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13405 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13406 LDKRoute route_conv;
13407 route_conv.inner = (void*)(route & (~1));
13408 route_conv.is_owned = false;
13409 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13410 LDKThirtyTwoBytes payment_preimage_ref;
13411 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13412 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13413 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13414 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
13415 return (uintptr_t)ret_conv;
13418 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) {
13419 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13420 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13421 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13422 LDKRoute route_conv;
13423 route_conv.inner = (void*)(route & (~1));
13424 route_conv.is_owned = false;
13425 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13426 LDKThirtyTwoBytes payment_id_ref;
13427 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13428 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13429 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13430 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
13431 return (uintptr_t)ret_conv;
13434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
13435 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13436 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13437 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13438 LDKThirtyTwoBytes payment_id_ref;
13439 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13440 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13441 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
13444 typedef struct LDKRouter_JCalls {
13445 atomic_size_t refcnt;
13448 jmethodID find_route_meth;
13449 } LDKRouter_JCalls;
13450 static void LDKRouter_JCalls_free(void* this_arg) {
13451 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13452 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13454 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13455 if (get_jenv_res == JNI_EDETACHED) {
13456 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13458 DO_ASSERT(get_jenv_res == JNI_OK);
13460 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13461 if (get_jenv_res == JNI_EDETACHED) {
13462 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13467 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
13468 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13470 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13471 if (get_jenv_res == JNI_EDETACHED) {
13472 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13474 DO_ASSERT(get_jenv_res == JNI_OK);
13476 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
13477 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
13478 LDKRouteParameters route_params_var = *route_params;
13479 uintptr_t route_params_ref = 0;
13480 route_params_var = RouteParameters_clone(route_params);
13481 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13482 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13483 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
13484 route_params_ref = (uintptr_t)route_params_var.inner;
13485 if (route_params_var.is_owned) {
13486 route_params_ref |= 1;
13488 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13489 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
13490 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
13491 int64_tArray first_hops_arr = NULL;
13492 if (first_hops != NULL) {
13493 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
13494 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
13495 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
13496 for (size_t q = 0; q < first_hops_var.datalen; q++) {
13497 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
13498 uintptr_t first_hops_conv_16_ref = 0;
13499 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13500 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13501 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
13502 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
13503 if (first_hops_conv_16_var.is_owned) {
13504 first_hops_conv_16_ref |= 1;
13506 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
13508 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
13510 // WARNING: This object doesn't live past this scope, needs clone!
13511 uintptr_t ret_scorer = ((uintptr_t)scorer) | 1;
13512 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13513 CHECK(obj != NULL);
13514 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, payment_hash_arr, first_hops_arr, ret_scorer);
13515 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13516 (*env)->ExceptionDescribe(env);
13517 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
13519 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13520 CHECK_ACCESS(ret_ptr);
13521 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
13523 if (get_jenv_res == JNI_EDETACHED) {
13524 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13528 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
13529 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
13530 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13532 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
13533 jclass c = (*env)->GetObjectClass(env, o);
13535 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
13536 atomic_init(&calls->refcnt, 1);
13537 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13538 calls->o = (*env)->NewWeakGlobalRef(env, o);
13539 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
13540 CHECK(calls->find_route_meth != NULL);
13543 .this_arg = (void*) calls,
13544 .find_route = find_route_LDKRouter_jcall,
13545 .free = LDKRouter_JCalls_free,
13549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
13550 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
13551 *res_ptr = LDKRouter_init(env, clz, o);
13552 return (uint64_t)res_ptr;
13554 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 route_params, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) {
13555 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13556 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13557 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
13558 LDKPublicKey payer_ref;
13559 CHECK((*env)->GetArrayLength(env, payer) == 33);
13560 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
13561 LDKRouteParameters route_params_conv;
13562 route_params_conv.inner = (void*)(route_params & (~1));
13563 route_params_conv.is_owned = false;
13564 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
13565 unsigned char payment_hash_arr[32];
13566 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13567 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
13568 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
13569 LDKCVec_ChannelDetailsZ first_hops_constr;
13570 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
13571 if (first_hops != NULL) {
13572 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
13573 if (first_hops_constr.datalen > 0)
13574 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13576 first_hops_constr.data = NULL;
13577 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
13578 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13579 int64_t first_hops_conv_16 = first_hops_vals[q];
13580 LDKChannelDetails first_hops_conv_16_conv;
13581 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
13582 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
13583 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
13584 first_hops_constr.data[q] = first_hops_conv_16_conv;
13586 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
13587 first_hops_ptr = &first_hops_constr;
13589 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
13590 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
13591 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
13592 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13593 *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, scorer_conv);
13594 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
13595 return (uintptr_t)ret_conv;
13598 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13599 LDKStr ret_str = _ldk_get_compiled_version();
13600 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13605 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13606 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
13607 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
13613 LDKTransaction _res_ref;
13614 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
13615 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
13616 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
13617 _res_ref.data_is_owned = true;
13618 Transaction_free(_res_ref);
13621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
13622 LDKCVec_u8Z script_pubkey_ref;
13623 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
13624 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
13625 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
13626 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13627 *ret_ref = TxOut_new(script_pubkey_ref, value);
13628 return (uintptr_t)ret_ref;
13631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
13632 if ((_res & 1) != 0) return;
13633 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13634 CHECK_ACCESS(_res_ptr);
13635 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
13637 TxOut_free(_res_conv);
13640 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
13641 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13642 *ret_ref = TxOut_clone(arg);
13643 return (uintptr_t)ret_ref;
13645 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13646 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
13647 intptr_t ret_val = TxOut_clone_ptr(arg_conv);
13651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13652 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
13653 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13654 *ret_ref = TxOut_clone(orig_conv);
13655 return (uintptr_t)ret_ref;
13658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
13659 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
13663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
13664 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13665 *ret_conv = CResult_NoneNoneZ_ok();
13666 return (uintptr_t)ret_conv;
13669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
13670 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13671 *ret_conv = CResult_NoneNoneZ_err();
13672 return (uintptr_t)ret_conv;
13675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13676 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
13677 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
13681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13682 if ((_res & 1) != 0) return;
13683 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13684 CHECK_ACCESS(_res_ptr);
13685 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
13687 CResult_NoneNoneZ_free(_res_conv);
13690 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
13691 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13692 *ret_conv = CResult_NoneNoneZ_clone(arg);
13693 return (uintptr_t)ret_conv;
13695 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13696 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
13697 intptr_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
13701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13702 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
13703 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13704 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
13705 return (uintptr_t)ret_conv;
13708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13709 LDKCounterpartyCommitmentSecrets o_conv;
13710 o_conv.inner = (void*)(o & (~1));
13711 o_conv.is_owned = (o & 1) || (o == 0);
13712 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13713 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
13714 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13715 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
13716 return (uintptr_t)ret_conv;
13719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13720 LDKDecodeError e_conv;
13721 e_conv.inner = (void*)(e & (~1));
13722 e_conv.is_owned = (e & 1) || (e == 0);
13723 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13724 e_conv = DecodeError_clone(&e_conv);
13725 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13726 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
13727 return (uintptr_t)ret_conv;
13730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13731 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
13732 jboolean ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
13736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13737 if ((_res & 1) != 0) return;
13738 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13739 CHECK_ACCESS(_res_ptr);
13740 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
13742 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
13745 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
13746 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13747 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
13748 return (uintptr_t)ret_conv;
13750 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13751 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
13752 intptr_t ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
13756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13757 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
13758 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13759 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
13760 return (uintptr_t)ret_conv;
13763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13764 LDKSecretKey o_ref;
13765 CHECK((*env)->GetArrayLength(env, o) == 32);
13766 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
13767 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13768 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
13769 return (uintptr_t)ret_conv;
13772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13773 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13774 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13775 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
13776 return (uintptr_t)ret_conv;
13779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13780 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
13781 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
13785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13786 if ((_res & 1) != 0) return;
13787 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13788 CHECK_ACCESS(_res_ptr);
13789 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
13791 CResult_SecretKeyErrorZ_free(_res_conv);
13794 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
13795 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13796 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
13797 return (uintptr_t)ret_conv;
13799 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13800 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
13801 intptr_t ret_val = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
13805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13806 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
13807 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13808 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
13809 return (uintptr_t)ret_conv;
13812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13813 LDKPublicKey o_ref;
13814 CHECK((*env)->GetArrayLength(env, o) == 33);
13815 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
13816 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13817 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
13818 return (uintptr_t)ret_conv;
13821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13822 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13823 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13824 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
13825 return (uintptr_t)ret_conv;
13828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13829 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
13830 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
13834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13835 if ((_res & 1) != 0) return;
13836 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13837 CHECK_ACCESS(_res_ptr);
13838 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
13840 CResult_PublicKeyErrorZ_free(_res_conv);
13843 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
13844 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13845 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
13846 return (uintptr_t)ret_conv;
13848 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13849 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
13850 intptr_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
13854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13855 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
13856 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13857 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
13858 return (uintptr_t)ret_conv;
13861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13862 LDKTxCreationKeys o_conv;
13863 o_conv.inner = (void*)(o & (~1));
13864 o_conv.is_owned = (o & 1) || (o == 0);
13865 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13866 o_conv = TxCreationKeys_clone(&o_conv);
13867 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13868 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
13869 return (uintptr_t)ret_conv;
13872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13873 LDKDecodeError e_conv;
13874 e_conv.inner = (void*)(e & (~1));
13875 e_conv.is_owned = (e & 1) || (e == 0);
13876 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13877 e_conv = DecodeError_clone(&e_conv);
13878 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13879 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
13880 return (uintptr_t)ret_conv;
13883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13884 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
13885 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
13889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13890 if ((_res & 1) != 0) return;
13891 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13892 CHECK_ACCESS(_res_ptr);
13893 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
13895 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
13898 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
13899 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13900 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
13901 return (uintptr_t)ret_conv;
13903 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13904 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
13905 intptr_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
13909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13910 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
13911 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13912 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
13913 return (uintptr_t)ret_conv;
13916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13917 LDKChannelPublicKeys o_conv;
13918 o_conv.inner = (void*)(o & (~1));
13919 o_conv.is_owned = (o & 1) || (o == 0);
13920 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13921 o_conv = ChannelPublicKeys_clone(&o_conv);
13922 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13923 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
13924 return (uintptr_t)ret_conv;
13927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13928 LDKDecodeError e_conv;
13929 e_conv.inner = (void*)(e & (~1));
13930 e_conv.is_owned = (e & 1) || (e == 0);
13931 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13932 e_conv = DecodeError_clone(&e_conv);
13933 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13934 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
13935 return (uintptr_t)ret_conv;
13938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13939 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
13940 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
13944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13945 if ((_res & 1) != 0) return;
13946 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13947 CHECK_ACCESS(_res_ptr);
13948 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
13950 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
13953 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
13954 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13955 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
13956 return (uintptr_t)ret_conv;
13958 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13959 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
13960 intptr_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
13964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13965 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
13966 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13967 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
13968 return (uintptr_t)ret_conv;
13971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13972 LDKTxCreationKeys o_conv;
13973 o_conv.inner = (void*)(o & (~1));
13974 o_conv.is_owned = (o & 1) || (o == 0);
13975 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13976 o_conv = TxCreationKeys_clone(&o_conv);
13977 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
13978 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
13979 return (uintptr_t)ret_conv;
13982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13983 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13984 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
13985 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
13986 return (uintptr_t)ret_conv;
13989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13990 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
13991 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
13995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13996 if ((_res & 1) != 0) return;
13997 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13998 CHECK_ACCESS(_res_ptr);
13999 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
14001 CResult_TxCreationKeysErrorZ_free(_res_conv);
14004 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
14005 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14006 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
14007 return (uintptr_t)ret_conv;
14009 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14010 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
14011 intptr_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
14015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14016 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
14017 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14018 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
14019 return (uintptr_t)ret_conv;
14022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
14023 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14024 *ret_copy = COption_u32Z_some(o);
14025 uintptr_t ret_ref = (uintptr_t)ret_copy;
14029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
14030 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14031 *ret_copy = COption_u32Z_none();
14032 uintptr_t ret_ref = (uintptr_t)ret_copy;
14036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14037 if ((_res & 1) != 0) return;
14038 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14039 CHECK_ACCESS(_res_ptr);
14040 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
14042 COption_u32Z_free(_res_conv);
14045 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
14046 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14047 *ret_copy = COption_u32Z_clone(arg);
14048 uintptr_t ret_ref = (uintptr_t)ret_copy;
14051 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14052 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
14053 intptr_t ret_val = COption_u32Z_clone_ptr(arg_conv);
14057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14058 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
14059 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14060 *ret_copy = COption_u32Z_clone(orig_conv);
14061 uintptr_t ret_ref = (uintptr_t)ret_copy;
14065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14066 LDKHTLCOutputInCommitment o_conv;
14067 o_conv.inner = (void*)(o & (~1));
14068 o_conv.is_owned = (o & 1) || (o == 0);
14069 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14070 o_conv = HTLCOutputInCommitment_clone(&o_conv);
14071 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14072 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
14073 return (uintptr_t)ret_conv;
14076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14077 LDKDecodeError e_conv;
14078 e_conv.inner = (void*)(e & (~1));
14079 e_conv.is_owned = (e & 1) || (e == 0);
14080 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14081 e_conv = DecodeError_clone(&e_conv);
14082 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14083 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
14084 return (uintptr_t)ret_conv;
14087 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14088 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
14089 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
14093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14094 if ((_res & 1) != 0) return;
14095 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14096 CHECK_ACCESS(_res_ptr);
14097 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
14099 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
14102 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
14103 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14104 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
14105 return (uintptr_t)ret_conv;
14107 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14108 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
14109 intptr_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
14113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14114 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
14115 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14116 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
14117 return (uintptr_t)ret_conv;
14120 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
14121 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
14125 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
14126 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
14130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
14131 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
14132 COption_NoneZ_free(_res_conv);
14135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14136 LDKCounterpartyChannelTransactionParameters o_conv;
14137 o_conv.inner = (void*)(o & (~1));
14138 o_conv.is_owned = (o & 1) || (o == 0);
14139 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14140 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
14141 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14142 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14143 return (uintptr_t)ret_conv;
14146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14147 LDKDecodeError e_conv;
14148 e_conv.inner = (void*)(e & (~1));
14149 e_conv.is_owned = (e & 1) || (e == 0);
14150 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14151 e_conv = DecodeError_clone(&e_conv);
14152 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14153 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
14154 return (uintptr_t)ret_conv;
14157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14158 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
14159 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14164 if ((_res & 1) != 0) return;
14165 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14166 CHECK_ACCESS(_res_ptr);
14167 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14169 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14172 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14173 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14174 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
14175 return (uintptr_t)ret_conv;
14177 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14178 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
14179 intptr_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14184 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
14185 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14186 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14187 return (uintptr_t)ret_conv;
14190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14191 LDKChannelTransactionParameters o_conv;
14192 o_conv.inner = (void*)(o & (~1));
14193 o_conv.is_owned = (o & 1) || (o == 0);
14194 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14195 o_conv = ChannelTransactionParameters_clone(&o_conv);
14196 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14197 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14198 return (uintptr_t)ret_conv;
14201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14202 LDKDecodeError e_conv;
14203 e_conv.inner = (void*)(e & (~1));
14204 e_conv.is_owned = (e & 1) || (e == 0);
14205 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14206 e_conv = DecodeError_clone(&e_conv);
14207 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14208 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
14209 return (uintptr_t)ret_conv;
14212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14213 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
14214 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14219 if ((_res & 1) != 0) return;
14220 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14221 CHECK_ACCESS(_res_ptr);
14222 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14224 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14227 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14228 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14229 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
14230 return (uintptr_t)ret_conv;
14232 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14233 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
14234 intptr_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14239 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
14240 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14241 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14242 return (uintptr_t)ret_conv;
14245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14246 LDKCVec_SignatureZ _res_constr;
14247 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14248 if (_res_constr.datalen > 0)
14249 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14251 _res_constr.data = NULL;
14252 for (size_t i = 0; i < _res_constr.datalen; i++) {
14253 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
14254 LDKSignature _res_conv_8_ref;
14255 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
14256 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
14257 _res_constr.data[i] = _res_conv_8_ref;
14259 CVec_SignatureZ_free(_res_constr);
14262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14263 LDKHolderCommitmentTransaction o_conv;
14264 o_conv.inner = (void*)(o & (~1));
14265 o_conv.is_owned = (o & 1) || (o == 0);
14266 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14267 o_conv = HolderCommitmentTransaction_clone(&o_conv);
14268 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14269 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
14270 return (uintptr_t)ret_conv;
14273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14274 LDKDecodeError e_conv;
14275 e_conv.inner = (void*)(e & (~1));
14276 e_conv.is_owned = (e & 1) || (e == 0);
14277 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14278 e_conv = DecodeError_clone(&e_conv);
14279 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14280 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
14281 return (uintptr_t)ret_conv;
14284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14285 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
14286 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14291 if ((_res & 1) != 0) return;
14292 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14293 CHECK_ACCESS(_res_ptr);
14294 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14296 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
14299 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14300 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14301 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
14302 return (uintptr_t)ret_conv;
14304 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14305 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
14306 intptr_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14311 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
14312 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14313 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14314 return (uintptr_t)ret_conv;
14317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14318 LDKBuiltCommitmentTransaction o_conv;
14319 o_conv.inner = (void*)(o & (~1));
14320 o_conv.is_owned = (o & 1) || (o == 0);
14321 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14322 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
14323 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14324 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
14325 return (uintptr_t)ret_conv;
14328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14329 LDKDecodeError e_conv;
14330 e_conv.inner = (void*)(e & (~1));
14331 e_conv.is_owned = (e & 1) || (e == 0);
14332 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14333 e_conv = DecodeError_clone(&e_conv);
14334 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14335 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
14336 return (uintptr_t)ret_conv;
14339 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14340 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
14341 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14346 if ((_res & 1) != 0) return;
14347 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14348 CHECK_ACCESS(_res_ptr);
14349 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14351 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
14354 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14355 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14356 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
14357 return (uintptr_t)ret_conv;
14359 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14360 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
14361 intptr_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14366 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
14367 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14368 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14369 return (uintptr_t)ret_conv;
14372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14373 LDKTrustedClosingTransaction o_conv;
14374 o_conv.inner = (void*)(o & (~1));
14375 o_conv.is_owned = (o & 1) || (o == 0);
14376 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14377 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
14378 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14379 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
14380 return (uintptr_t)ret_conv;
14383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14384 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14385 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
14386 return (uintptr_t)ret_conv;
14389 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14390 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
14391 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
14395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14396 if ((_res & 1) != 0) return;
14397 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14398 CHECK_ACCESS(_res_ptr);
14399 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
14401 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
14404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14405 LDKCommitmentTransaction o_conv;
14406 o_conv.inner = (void*)(o & (~1));
14407 o_conv.is_owned = (o & 1) || (o == 0);
14408 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14409 o_conv = CommitmentTransaction_clone(&o_conv);
14410 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14411 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
14412 return (uintptr_t)ret_conv;
14415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14416 LDKDecodeError e_conv;
14417 e_conv.inner = (void*)(e & (~1));
14418 e_conv.is_owned = (e & 1) || (e == 0);
14419 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14420 e_conv = DecodeError_clone(&e_conv);
14421 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14422 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
14423 return (uintptr_t)ret_conv;
14426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14427 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
14428 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14433 if ((_res & 1) != 0) return;
14434 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14435 CHECK_ACCESS(_res_ptr);
14436 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
14438 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
14441 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14442 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14443 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
14444 return (uintptr_t)ret_conv;
14446 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14447 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
14448 intptr_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14453 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
14454 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14455 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
14456 return (uintptr_t)ret_conv;
14459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14460 LDKTrustedCommitmentTransaction o_conv;
14461 o_conv.inner = (void*)(o & (~1));
14462 o_conv.is_owned = (o & 1) || (o == 0);
14463 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14464 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
14465 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14466 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
14467 return (uintptr_t)ret_conv;
14470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14471 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14472 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
14473 return (uintptr_t)ret_conv;
14476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14477 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
14478 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
14482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14483 if ((_res & 1) != 0) return;
14484 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14485 CHECK_ACCESS(_res_ptr);
14486 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
14488 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
14491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
14492 LDKCVec_SignatureZ o_constr;
14493 o_constr.datalen = (*env)->GetArrayLength(env, o);
14494 if (o_constr.datalen > 0)
14495 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14497 o_constr.data = NULL;
14498 for (size_t i = 0; i < o_constr.datalen; i++) {
14499 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
14500 LDKSignature o_conv_8_ref;
14501 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
14502 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
14503 o_constr.data[i] = o_conv_8_ref;
14505 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14506 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
14507 return (uintptr_t)ret_conv;
14510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
14511 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14512 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
14513 return (uintptr_t)ret_conv;
14516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14517 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
14518 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
14522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14523 if ((_res & 1) != 0) return;
14524 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14525 CHECK_ACCESS(_res_ptr);
14526 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
14528 CResult_CVec_SignatureZNoneZ_free(_res_conv);
14531 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
14532 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14533 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
14534 return (uintptr_t)ret_conv;
14536 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14537 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
14538 intptr_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
14542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14543 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
14544 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14545 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
14546 return (uintptr_t)ret_conv;
14549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14550 LDKShutdownScript o_conv;
14551 o_conv.inner = (void*)(o & (~1));
14552 o_conv.is_owned = (o & 1) || (o == 0);
14553 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14554 o_conv = ShutdownScript_clone(&o_conv);
14555 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14556 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
14557 return (uintptr_t)ret_conv;
14560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14561 LDKDecodeError e_conv;
14562 e_conv.inner = (void*)(e & (~1));
14563 e_conv.is_owned = (e & 1) || (e == 0);
14564 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14565 e_conv = DecodeError_clone(&e_conv);
14566 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14567 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
14568 return (uintptr_t)ret_conv;
14571 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14572 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
14573 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
14577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14578 if ((_res & 1) != 0) return;
14579 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14580 CHECK_ACCESS(_res_ptr);
14581 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
14583 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
14586 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
14587 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14588 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
14589 return (uintptr_t)ret_conv;
14591 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14592 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
14593 intptr_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
14597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14598 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
14599 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14600 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
14601 return (uintptr_t)ret_conv;
14604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14605 LDKShutdownScript o_conv;
14606 o_conv.inner = (void*)(o & (~1));
14607 o_conv.is_owned = (o & 1) || (o == 0);
14608 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14609 o_conv = ShutdownScript_clone(&o_conv);
14610 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14611 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
14612 return (uintptr_t)ret_conv;
14615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14616 LDKInvalidShutdownScript e_conv;
14617 e_conv.inner = (void*)(e & (~1));
14618 e_conv.is_owned = (e & 1) || (e == 0);
14619 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14620 e_conv = InvalidShutdownScript_clone(&e_conv);
14621 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14622 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
14623 return (uintptr_t)ret_conv;
14626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14627 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
14628 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
14632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14633 if ((_res & 1) != 0) return;
14634 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14635 CHECK_ACCESS(_res_ptr);
14636 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
14638 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
14641 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
14642 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14643 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
14644 return (uintptr_t)ret_conv;
14646 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14647 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
14648 intptr_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
14652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14653 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
14654 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14655 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
14656 return (uintptr_t)ret_conv;
14659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
14660 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14661 *ret_conv = CResult_NoneErrorZ_ok();
14662 return (uintptr_t)ret_conv;
14665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14666 LDKIOError e_conv = LDKIOError_from_java(env, e);
14667 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14668 *ret_conv = CResult_NoneErrorZ_err(e_conv);
14669 return (uintptr_t)ret_conv;
14672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14673 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
14674 jboolean ret_val = CResult_NoneErrorZ_is_ok(o_conv);
14678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_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 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
14684 CResult_NoneErrorZ_free(_res_conv);
14687 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
14688 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14689 *ret_conv = CResult_NoneErrorZ_clone(arg);
14690 return (uintptr_t)ret_conv;
14692 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14693 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
14694 intptr_t ret_val = CResult_NoneErrorZ_clone_ptr(arg_conv);
14698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14699 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
14700 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14701 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
14702 return (uintptr_t)ret_conv;
14705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14706 LDKRouteHop o_conv;
14707 o_conv.inner = (void*)(o & (~1));
14708 o_conv.is_owned = (o & 1) || (o == 0);
14709 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14710 o_conv = RouteHop_clone(&o_conv);
14711 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14712 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
14713 return (uintptr_t)ret_conv;
14716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14717 LDKDecodeError e_conv;
14718 e_conv.inner = (void*)(e & (~1));
14719 e_conv.is_owned = (e & 1) || (e == 0);
14720 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14721 e_conv = DecodeError_clone(&e_conv);
14722 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14723 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
14724 return (uintptr_t)ret_conv;
14727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14728 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
14729 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
14733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14734 if ((_res & 1) != 0) return;
14735 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14736 CHECK_ACCESS(_res_ptr);
14737 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
14739 CResult_RouteHopDecodeErrorZ_free(_res_conv);
14742 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
14743 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14744 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
14745 return (uintptr_t)ret_conv;
14747 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14748 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
14749 intptr_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
14753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14754 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
14755 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14756 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
14757 return (uintptr_t)ret_conv;
14760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14761 LDKCVec_RouteHopZ _res_constr;
14762 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14763 if (_res_constr.datalen > 0)
14764 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14766 _res_constr.data = NULL;
14767 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14768 for (size_t k = 0; k < _res_constr.datalen; k++) {
14769 int64_t _res_conv_10 = _res_vals[k];
14770 LDKRouteHop _res_conv_10_conv;
14771 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
14772 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
14773 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
14774 _res_constr.data[k] = _res_conv_10_conv;
14776 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14777 CVec_RouteHopZ_free(_res_constr);
14780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14781 LDKCVec_CVec_RouteHopZZ _res_constr;
14782 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14783 if (_res_constr.datalen > 0)
14784 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
14786 _res_constr.data = NULL;
14787 for (size_t m = 0; m < _res_constr.datalen; m++) {
14788 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
14789 LDKCVec_RouteHopZ _res_conv_12_constr;
14790 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
14791 if (_res_conv_12_constr.datalen > 0)
14792 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14794 _res_conv_12_constr.data = NULL;
14795 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
14796 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
14797 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
14798 LDKRouteHop _res_conv_12_conv_10_conv;
14799 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
14800 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
14801 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
14802 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
14804 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
14805 _res_constr.data[m] = _res_conv_12_constr;
14807 CVec_CVec_RouteHopZZ_free(_res_constr);
14810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14812 o_conv.inner = (void*)(o & (~1));
14813 o_conv.is_owned = (o & 1) || (o == 0);
14814 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14815 o_conv = Route_clone(&o_conv);
14816 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14817 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
14818 return (uintptr_t)ret_conv;
14821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14822 LDKDecodeError e_conv;
14823 e_conv.inner = (void*)(e & (~1));
14824 e_conv.is_owned = (e & 1) || (e == 0);
14825 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14826 e_conv = DecodeError_clone(&e_conv);
14827 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14828 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
14829 return (uintptr_t)ret_conv;
14832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14833 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
14834 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
14838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14839 if ((_res & 1) != 0) return;
14840 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14841 CHECK_ACCESS(_res_ptr);
14842 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
14844 CResult_RouteDecodeErrorZ_free(_res_conv);
14847 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
14848 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14849 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
14850 return (uintptr_t)ret_conv;
14852 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14853 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
14854 intptr_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
14858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14859 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
14860 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14861 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
14862 return (uintptr_t)ret_conv;
14865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14866 LDKRouteParameters o_conv;
14867 o_conv.inner = (void*)(o & (~1));
14868 o_conv.is_owned = (o & 1) || (o == 0);
14869 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14870 o_conv = RouteParameters_clone(&o_conv);
14871 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14872 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
14873 return (uintptr_t)ret_conv;
14876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14877 LDKDecodeError e_conv;
14878 e_conv.inner = (void*)(e & (~1));
14879 e_conv.is_owned = (e & 1) || (e == 0);
14880 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14881 e_conv = DecodeError_clone(&e_conv);
14882 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14883 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
14884 return (uintptr_t)ret_conv;
14887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14888 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
14889 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
14893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14894 if ((_res & 1) != 0) return;
14895 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14896 CHECK_ACCESS(_res_ptr);
14897 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
14899 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
14902 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
14903 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14904 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
14905 return (uintptr_t)ret_conv;
14907 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14908 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
14909 intptr_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
14913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14914 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
14915 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14916 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
14917 return (uintptr_t)ret_conv;
14920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14921 LDKCVec_RouteHintZ _res_constr;
14922 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14923 if (_res_constr.datalen > 0)
14924 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
14926 _res_constr.data = NULL;
14927 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14928 for (size_t l = 0; l < _res_constr.datalen; l++) {
14929 int64_t _res_conv_11 = _res_vals[l];
14930 LDKRouteHint _res_conv_11_conv;
14931 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
14932 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
14933 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
14934 _res_constr.data[l] = _res_conv_11_conv;
14936 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14937 CVec_RouteHintZ_free(_res_constr);
14940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
14941 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14942 *ret_copy = COption_u64Z_some(o);
14943 uintptr_t ret_ref = (uintptr_t)ret_copy;
14947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
14948 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14949 *ret_copy = COption_u64Z_none();
14950 uintptr_t ret_ref = (uintptr_t)ret_copy;
14954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14955 if ((_res & 1) != 0) return;
14956 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14957 CHECK_ACCESS(_res_ptr);
14958 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
14960 COption_u64Z_free(_res_conv);
14963 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
14964 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14965 *ret_copy = COption_u64Z_clone(arg);
14966 uintptr_t ret_ref = (uintptr_t)ret_copy;
14969 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14970 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
14971 intptr_t ret_val = COption_u64Z_clone_ptr(arg_conv);
14975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14976 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
14977 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14978 *ret_copy = COption_u64Z_clone(orig_conv);
14979 uintptr_t ret_ref = (uintptr_t)ret_copy;
14983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14984 LDKPaymentParameters o_conv;
14985 o_conv.inner = (void*)(o & (~1));
14986 o_conv.is_owned = (o & 1) || (o == 0);
14987 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14988 o_conv = PaymentParameters_clone(&o_conv);
14989 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
14990 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
14991 return (uintptr_t)ret_conv;
14994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14995 LDKDecodeError e_conv;
14996 e_conv.inner = (void*)(e & (~1));
14997 e_conv.is_owned = (e & 1) || (e == 0);
14998 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14999 e_conv = DecodeError_clone(&e_conv);
15000 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15001 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
15002 return (uintptr_t)ret_conv;
15005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15006 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
15007 jboolean ret_val = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
15011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15012 if ((_res & 1) != 0) return;
15013 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15014 CHECK_ACCESS(_res_ptr);
15015 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
15017 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
15020 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
15021 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15022 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
15023 return (uintptr_t)ret_conv;
15025 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15026 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
15027 intptr_t ret_val = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
15031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15032 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
15033 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15034 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
15035 return (uintptr_t)ret_conv;
15038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15039 LDKCVec_RouteHintHopZ _res_constr;
15040 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15041 if (_res_constr.datalen > 0)
15042 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
15044 _res_constr.data = NULL;
15045 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15046 for (size_t o = 0; o < _res_constr.datalen; o++) {
15047 int64_t _res_conv_14 = _res_vals[o];
15048 LDKRouteHintHop _res_conv_14_conv;
15049 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
15050 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
15051 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15052 _res_constr.data[o] = _res_conv_14_conv;
15054 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15055 CVec_RouteHintHopZ_free(_res_constr);
15058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15059 LDKRouteHint o_conv;
15060 o_conv.inner = (void*)(o & (~1));
15061 o_conv.is_owned = (o & 1) || (o == 0);
15062 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15063 o_conv = RouteHint_clone(&o_conv);
15064 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15065 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
15066 return (uintptr_t)ret_conv;
15069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15070 LDKDecodeError e_conv;
15071 e_conv.inner = (void*)(e & (~1));
15072 e_conv.is_owned = (e & 1) || (e == 0);
15073 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15074 e_conv = DecodeError_clone(&e_conv);
15075 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15076 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
15077 return (uintptr_t)ret_conv;
15080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15081 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
15082 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
15086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15087 if ((_res & 1) != 0) return;
15088 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15089 CHECK_ACCESS(_res_ptr);
15090 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
15092 CResult_RouteHintDecodeErrorZ_free(_res_conv);
15095 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
15096 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15097 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
15098 return (uintptr_t)ret_conv;
15100 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15101 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
15102 intptr_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
15106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15107 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
15108 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15109 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
15110 return (uintptr_t)ret_conv;
15113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15114 LDKRouteHintHop o_conv;
15115 o_conv.inner = (void*)(o & (~1));
15116 o_conv.is_owned = (o & 1) || (o == 0);
15117 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15118 o_conv = RouteHintHop_clone(&o_conv);
15119 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15120 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
15121 return (uintptr_t)ret_conv;
15124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15125 LDKDecodeError e_conv;
15126 e_conv.inner = (void*)(e & (~1));
15127 e_conv.is_owned = (e & 1) || (e == 0);
15128 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15129 e_conv = DecodeError_clone(&e_conv);
15130 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15131 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
15132 return (uintptr_t)ret_conv;
15135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15136 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
15137 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
15141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15142 if ((_res & 1) != 0) return;
15143 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15144 CHECK_ACCESS(_res_ptr);
15145 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
15147 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
15150 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
15151 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15152 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
15153 return (uintptr_t)ret_conv;
15155 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15156 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
15157 intptr_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
15161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15162 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
15163 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15164 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
15165 return (uintptr_t)ret_conv;
15168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15169 LDKCVec_ChannelDetailsZ _res_constr;
15170 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15171 if (_res_constr.datalen > 0)
15172 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
15174 _res_constr.data = NULL;
15175 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15176 for (size_t q = 0; q < _res_constr.datalen; q++) {
15177 int64_t _res_conv_16 = _res_vals[q];
15178 LDKChannelDetails _res_conv_16_conv;
15179 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
15180 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
15181 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15182 _res_constr.data[q] = _res_conv_16_conv;
15184 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15185 CVec_ChannelDetailsZ_free(_res_constr);
15188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15190 o_conv.inner = (void*)(o & (~1));
15191 o_conv.is_owned = (o & 1) || (o == 0);
15192 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15193 o_conv = Route_clone(&o_conv);
15194 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15195 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
15196 return (uintptr_t)ret_conv;
15199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15200 LDKLightningError e_conv;
15201 e_conv.inner = (void*)(e & (~1));
15202 e_conv.is_owned = (e & 1) || (e == 0);
15203 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15204 e_conv = LightningError_clone(&e_conv);
15205 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15206 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
15207 return (uintptr_t)ret_conv;
15210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15211 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
15212 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
15216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15217 if ((_res & 1) != 0) return;
15218 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15219 CHECK_ACCESS(_res_ptr);
15220 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
15222 CResult_RouteLightningErrorZ_free(_res_conv);
15225 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
15226 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15227 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
15228 return (uintptr_t)ret_conv;
15230 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15231 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
15232 intptr_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
15236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15237 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
15238 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15239 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
15240 return (uintptr_t)ret_conv;
15243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15244 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15245 CHECK_ACCESS(o_ptr);
15246 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
15247 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
15248 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15249 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
15250 return (uintptr_t)ret_conv;
15253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15254 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
15255 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15256 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
15257 return (uintptr_t)ret_conv;
15260 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15261 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
15262 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
15266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15267 if ((_res & 1) != 0) return;
15268 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15269 CHECK_ACCESS(_res_ptr);
15270 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
15272 CResult_TxOutAccessErrorZ_free(_res_conv);
15275 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
15276 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15277 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
15278 return (uintptr_t)ret_conv;
15280 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15281 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
15282 intptr_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
15286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15287 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
15288 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15289 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
15290 return (uintptr_t)ret_conv;
15293 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
15294 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15295 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
15296 return ((uintptr_t)ret_conv);
15298 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15299 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
15300 intptr_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
15304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15305 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
15306 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15307 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
15308 return ((uintptr_t)ret_conv);
15311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, intptr_t a, int8_tArray b) {
15312 LDKTransaction b_ref;
15313 b_ref.datalen = (*env)->GetArrayLength(env, b);
15314 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
15315 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
15316 b_ref.data_is_owned = true;
15317 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15318 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
15319 return ((uintptr_t)ret_conv);
15322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15323 if ((_res & 1) != 0) return;
15324 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15325 CHECK_ACCESS(_res_ptr);
15326 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
15328 C2Tuple_usizeTransactionZ_free(_res_conv);
15331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15332 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
15333 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15334 if (_res_constr.datalen > 0)
15335 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15337 _res_constr.data = NULL;
15338 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15339 for (size_t c = 0; c < _res_constr.datalen; c++) {
15340 int64_t _res_conv_28 = _res_vals[c];
15341 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
15342 CHECK_ACCESS(_res_conv_28_ptr);
15343 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
15344 FREE((void*)_res_conv_28);
15345 _res_constr.data[c] = _res_conv_28_conv;
15347 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15348 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
15351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15352 LDKCVec_TxidZ _res_constr;
15353 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15354 if (_res_constr.datalen > 0)
15355 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
15357 _res_constr.data = NULL;
15358 for (size_t i = 0; i < _res_constr.datalen; i++) {
15359 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15360 LDKThirtyTwoBytes _res_conv_8_ref;
15361 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
15362 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
15363 _res_constr.data[i] = _res_conv_8_ref;
15365 CVec_TxidZ_free(_res_constr);
15368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
15369 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15370 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
15371 return (uintptr_t)ret_conv;
15374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
15375 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
15376 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15377 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
15378 return (uintptr_t)ret_conv;
15381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15382 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
15383 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
15387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15388 if ((_res & 1) != 0) return;
15389 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15390 CHECK_ACCESS(_res_ptr);
15391 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
15393 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
15396 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
15397 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15398 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
15399 return (uintptr_t)ret_conv;
15401 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15402 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
15403 intptr_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
15407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15408 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
15409 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15410 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
15411 return (uintptr_t)ret_conv;
15414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15415 LDKCVec_MonitorEventZ _res_constr;
15416 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15417 if (_res_constr.datalen > 0)
15418 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
15420 _res_constr.data = NULL;
15421 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15422 for (size_t o = 0; o < _res_constr.datalen; o++) {
15423 int64_t _res_conv_14 = _res_vals[o];
15424 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
15425 CHECK_ACCESS(_res_conv_14_ptr);
15426 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
15427 FREE((void*)_res_conv_14);
15428 _res_constr.data[o] = _res_conv_14_conv;
15430 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15431 CVec_MonitorEventZ_free(_res_constr);
15434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15435 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15436 CHECK_ACCESS(o_ptr);
15437 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
15438 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
15439 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15440 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
15441 uintptr_t ret_ref = (uintptr_t)ret_copy;
15445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
15446 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15447 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
15448 uintptr_t ret_ref = (uintptr_t)ret_copy;
15452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15453 if ((_res & 1) != 0) return;
15454 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15455 CHECK_ACCESS(_res_ptr);
15456 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
15458 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
15461 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
15462 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15463 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
15464 uintptr_t ret_ref = (uintptr_t)ret_copy;
15467 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15468 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
15469 intptr_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
15473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15474 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
15475 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15476 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
15477 uintptr_t ret_ref = (uintptr_t)ret_copy;
15481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15482 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15483 CHECK_ACCESS(o_ptr);
15484 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
15485 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
15486 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15487 *ret_copy = COption_ClosureReasonZ_some(o_conv);
15488 uintptr_t ret_ref = (uintptr_t)ret_copy;
15492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
15493 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15494 *ret_copy = COption_ClosureReasonZ_none();
15495 uintptr_t ret_ref = (uintptr_t)ret_copy;
15499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15500 if ((_res & 1) != 0) return;
15501 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15502 CHECK_ACCESS(_res_ptr);
15503 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
15505 COption_ClosureReasonZ_free(_res_conv);
15508 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
15509 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15510 *ret_copy = COption_ClosureReasonZ_clone(arg);
15511 uintptr_t ret_ref = (uintptr_t)ret_copy;
15514 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15515 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
15516 intptr_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
15520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15521 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
15522 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15523 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
15524 uintptr_t ret_ref = (uintptr_t)ret_copy;
15528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15529 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15530 CHECK_ACCESS(o_ptr);
15531 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
15532 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
15533 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15534 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
15535 return (uintptr_t)ret_conv;
15538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15539 LDKDecodeError e_conv;
15540 e_conv.inner = (void*)(e & (~1));
15541 e_conv.is_owned = (e & 1) || (e == 0);
15542 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15543 e_conv = DecodeError_clone(&e_conv);
15544 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15545 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
15546 return (uintptr_t)ret_conv;
15549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15550 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
15551 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
15555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15556 if ((_res & 1) != 0) return;
15557 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15558 CHECK_ACCESS(_res_ptr);
15559 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
15561 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
15564 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
15565 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15566 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
15567 return (uintptr_t)ret_conv;
15569 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15570 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
15571 intptr_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
15575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15576 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
15577 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15578 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
15579 return (uintptr_t)ret_conv;
15582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15583 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15584 CHECK_ACCESS(o_ptr);
15585 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
15586 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
15587 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15588 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
15589 uintptr_t ret_ref = (uintptr_t)ret_copy;
15593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
15594 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15595 *ret_copy = COption_NetworkUpdateZ_none();
15596 uintptr_t ret_ref = (uintptr_t)ret_copy;
15600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15601 if ((_res & 1) != 0) return;
15602 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15603 CHECK_ACCESS(_res_ptr);
15604 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
15606 COption_NetworkUpdateZ_free(_res_conv);
15609 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
15610 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15611 *ret_copy = COption_NetworkUpdateZ_clone(arg);
15612 uintptr_t ret_ref = (uintptr_t)ret_copy;
15615 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15616 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
15617 intptr_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
15621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15622 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
15623 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15624 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
15625 uintptr_t ret_ref = (uintptr_t)ret_copy;
15629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15630 LDKCVec_SpendableOutputDescriptorZ _res_constr;
15631 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15632 if (_res_constr.datalen > 0)
15633 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15635 _res_constr.data = NULL;
15636 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15637 for (size_t b = 0; b < _res_constr.datalen; b++) {
15638 int64_t _res_conv_27 = _res_vals[b];
15639 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
15640 CHECK_ACCESS(_res_conv_27_ptr);
15641 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
15642 FREE((void*)_res_conv_27);
15643 _res_constr.data[b] = _res_conv_27_conv;
15645 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15646 CVec_SpendableOutputDescriptorZ_free(_res_constr);
15649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15650 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15651 CHECK_ACCESS(o_ptr);
15652 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
15653 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
15654 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15655 *ret_copy = COption_EventZ_some(o_conv);
15656 uintptr_t ret_ref = (uintptr_t)ret_copy;
15660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
15661 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15662 *ret_copy = COption_EventZ_none();
15663 uintptr_t ret_ref = (uintptr_t)ret_copy;
15667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15668 if ((_res & 1) != 0) return;
15669 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15670 CHECK_ACCESS(_res_ptr);
15671 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
15673 COption_EventZ_free(_res_conv);
15676 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
15677 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15678 *ret_copy = COption_EventZ_clone(arg);
15679 uintptr_t ret_ref = (uintptr_t)ret_copy;
15682 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15683 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
15684 intptr_t ret_val = COption_EventZ_clone_ptr(arg_conv);
15688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15689 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
15690 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15691 *ret_copy = COption_EventZ_clone(orig_conv);
15692 uintptr_t ret_ref = (uintptr_t)ret_copy;
15696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15697 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15698 CHECK_ACCESS(o_ptr);
15699 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
15700 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
15701 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15702 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
15703 return (uintptr_t)ret_conv;
15706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15707 LDKDecodeError e_conv;
15708 e_conv.inner = (void*)(e & (~1));
15709 e_conv.is_owned = (e & 1) || (e == 0);
15710 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15711 e_conv = DecodeError_clone(&e_conv);
15712 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15713 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
15714 return (uintptr_t)ret_conv;
15717 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15718 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
15719 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
15723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15724 if ((_res & 1) != 0) return;
15725 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15726 CHECK_ACCESS(_res_ptr);
15727 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
15729 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
15732 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
15733 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15734 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
15735 return (uintptr_t)ret_conv;
15737 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15738 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
15739 intptr_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
15743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15744 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
15745 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15746 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
15747 return (uintptr_t)ret_conv;
15750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15751 LDKCVec_MessageSendEventZ _res_constr;
15752 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15753 if (_res_constr.datalen > 0)
15754 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15756 _res_constr.data = NULL;
15757 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15758 for (size_t s = 0; s < _res_constr.datalen; s++) {
15759 int64_t _res_conv_18 = _res_vals[s];
15760 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
15761 CHECK_ACCESS(_res_conv_18_ptr);
15762 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
15763 FREE((void*)_res_conv_18);
15764 _res_constr.data[s] = _res_conv_18_conv;
15766 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15767 CVec_MessageSendEventZ_free(_res_constr);
15770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15771 LDKFixedPenaltyScorer o_conv;
15772 o_conv.inner = (void*)(o & (~1));
15773 o_conv.is_owned = (o & 1) || (o == 0);
15774 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15775 o_conv = FixedPenaltyScorer_clone(&o_conv);
15776 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
15777 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
15778 return (uintptr_t)ret_conv;
15781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15782 LDKDecodeError e_conv;
15783 e_conv.inner = (void*)(e & (~1));
15784 e_conv.is_owned = (e & 1) || (e == 0);
15785 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15786 e_conv = DecodeError_clone(&e_conv);
15787 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
15788 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
15789 return (uintptr_t)ret_conv;
15792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15793 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
15794 jboolean ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
15798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15799 if ((_res & 1) != 0) return;
15800 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15801 CHECK_ACCESS(_res_ptr);
15802 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
15804 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
15807 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
15808 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
15809 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
15810 return (uintptr_t)ret_conv;
15812 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15813 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
15814 intptr_t ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
15818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15819 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
15820 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
15821 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
15822 return (uintptr_t)ret_conv;
15825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15826 LDKScoringParameters o_conv;
15827 o_conv.inner = (void*)(o & (~1));
15828 o_conv.is_owned = (o & 1) || (o == 0);
15829 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15830 o_conv = ScoringParameters_clone(&o_conv);
15831 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
15832 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
15833 return (uintptr_t)ret_conv;
15836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15837 LDKDecodeError e_conv;
15838 e_conv.inner = (void*)(e & (~1));
15839 e_conv.is_owned = (e & 1) || (e == 0);
15840 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15841 e_conv = DecodeError_clone(&e_conv);
15842 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
15843 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
15844 return (uintptr_t)ret_conv;
15847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15848 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
15849 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
15853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15854 if ((_res & 1) != 0) return;
15855 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15856 CHECK_ACCESS(_res_ptr);
15857 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
15859 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
15862 static inline uintptr_t CResult_ScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR arg) {
15863 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
15864 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(arg);
15865 return (uintptr_t)ret_conv;
15867 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15868 LDKCResult_ScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
15869 intptr_t ret_val = CResult_ScoringParametersDecodeErrorZ_clone_ptr(arg_conv);
15873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15874 LDKCResult_ScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(orig & ~1);
15875 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
15876 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(orig_conv);
15877 return (uintptr_t)ret_conv;
15880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15882 o_conv.inner = (void*)(o & (~1));
15883 o_conv.is_owned = (o & 1) || (o == 0);
15884 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15885 // WARNING: we need a move here but no clone is available for LDKScorer
15886 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
15887 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
15888 return (uintptr_t)ret_conv;
15891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15892 LDKDecodeError e_conv;
15893 e_conv.inner = (void*)(e & (~1));
15894 e_conv.is_owned = (e & 1) || (e == 0);
15895 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15896 e_conv = DecodeError_clone(&e_conv);
15897 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
15898 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
15899 return (uintptr_t)ret_conv;
15902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15903 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
15904 jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
15908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15909 if ((_res & 1) != 0) return;
15910 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15911 CHECK_ACCESS(_res_ptr);
15912 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
15914 CResult_ScorerDecodeErrorZ_free(_res_conv);
15917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15918 LDKProbabilisticScoringParameters o_conv;
15919 o_conv.inner = (void*)(o & (~1));
15920 o_conv.is_owned = (o & 1) || (o == 0);
15921 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15922 o_conv = ProbabilisticScoringParameters_clone(&o_conv);
15923 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
15924 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o_conv);
15925 return (uintptr_t)ret_conv;
15928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15929 LDKDecodeError e_conv;
15930 e_conv.inner = (void*)(e & (~1));
15931 e_conv.is_owned = (e & 1) || (e == 0);
15932 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15933 e_conv = DecodeError_clone(&e_conv);
15934 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
15935 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e_conv);
15936 return (uintptr_t)ret_conv;
15939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15940 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(o & ~1);
15941 jboolean ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o_conv);
15945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15946 if ((_res & 1) != 0) return;
15947 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15948 CHECK_ACCESS(_res_ptr);
15949 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(_res_ptr);
15951 CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res_conv);
15954 static inline uintptr_t CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR arg) {
15955 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
15956 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(arg);
15957 return (uintptr_t)ret_conv;
15959 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15960 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(arg & ~1);
15961 intptr_t ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(arg_conv);
15965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15966 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(orig & ~1);
15967 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
15968 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig_conv);
15969 return (uintptr_t)ret_conv;
15972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15973 LDKInitFeatures o_conv;
15974 o_conv.inner = (void*)(o & (~1));
15975 o_conv.is_owned = (o & 1) || (o == 0);
15976 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15977 o_conv = InitFeatures_clone(&o_conv);
15978 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
15979 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
15980 return (uintptr_t)ret_conv;
15983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15984 LDKDecodeError e_conv;
15985 e_conv.inner = (void*)(e & (~1));
15986 e_conv.is_owned = (e & 1) || (e == 0);
15987 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15988 e_conv = DecodeError_clone(&e_conv);
15989 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
15990 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
15991 return (uintptr_t)ret_conv;
15994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15995 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
15996 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
16000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16001 if ((_res & 1) != 0) return;
16002 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16003 CHECK_ACCESS(_res_ptr);
16004 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
16006 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
16009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16010 LDKChannelFeatures o_conv;
16011 o_conv.inner = (void*)(o & (~1));
16012 o_conv.is_owned = (o & 1) || (o == 0);
16013 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16014 o_conv = ChannelFeatures_clone(&o_conv);
16015 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16016 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
16017 return (uintptr_t)ret_conv;
16020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16021 LDKDecodeError e_conv;
16022 e_conv.inner = (void*)(e & (~1));
16023 e_conv.is_owned = (e & 1) || (e == 0);
16024 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16025 e_conv = DecodeError_clone(&e_conv);
16026 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16027 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
16028 return (uintptr_t)ret_conv;
16031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16032 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
16033 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
16037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16038 if ((_res & 1) != 0) return;
16039 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16040 CHECK_ACCESS(_res_ptr);
16041 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
16043 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
16046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16047 LDKNodeFeatures o_conv;
16048 o_conv.inner = (void*)(o & (~1));
16049 o_conv.is_owned = (o & 1) || (o == 0);
16050 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16051 o_conv = NodeFeatures_clone(&o_conv);
16052 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16053 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
16054 return (uintptr_t)ret_conv;
16057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16058 LDKDecodeError e_conv;
16059 e_conv.inner = (void*)(e & (~1));
16060 e_conv.is_owned = (e & 1) || (e == 0);
16061 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16062 e_conv = DecodeError_clone(&e_conv);
16063 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16064 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
16065 return (uintptr_t)ret_conv;
16068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16069 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
16070 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
16074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16075 if ((_res & 1) != 0) return;
16076 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16077 CHECK_ACCESS(_res_ptr);
16078 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
16080 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
16083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16084 LDKInvoiceFeatures o_conv;
16085 o_conv.inner = (void*)(o & (~1));
16086 o_conv.is_owned = (o & 1) || (o == 0);
16087 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16088 o_conv = InvoiceFeatures_clone(&o_conv);
16089 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16090 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
16091 return (uintptr_t)ret_conv;
16094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16095 LDKDecodeError e_conv;
16096 e_conv.inner = (void*)(e & (~1));
16097 e_conv.is_owned = (e & 1) || (e == 0);
16098 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16099 e_conv = DecodeError_clone(&e_conv);
16100 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16101 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
16102 return (uintptr_t)ret_conv;
16105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16106 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
16107 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
16111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16112 if ((_res & 1) != 0) return;
16113 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16114 CHECK_ACCESS(_res_ptr);
16115 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
16117 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
16120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16121 LDKChannelTypeFeatures o_conv;
16122 o_conv.inner = (void*)(o & (~1));
16123 o_conv.is_owned = (o & 1) || (o == 0);
16124 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16125 o_conv = ChannelTypeFeatures_clone(&o_conv);
16126 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16127 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
16128 return (uintptr_t)ret_conv;
16131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16132 LDKDecodeError e_conv;
16133 e_conv.inner = (void*)(e & (~1));
16134 e_conv.is_owned = (e & 1) || (e == 0);
16135 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16136 e_conv = DecodeError_clone(&e_conv);
16137 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16138 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
16139 return (uintptr_t)ret_conv;
16142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16143 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
16144 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
16148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16149 if ((_res & 1) != 0) return;
16150 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16151 CHECK_ACCESS(_res_ptr);
16152 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
16154 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
16157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16158 LDKDelayedPaymentOutputDescriptor o_conv;
16159 o_conv.inner = (void*)(o & (~1));
16160 o_conv.is_owned = (o & 1) || (o == 0);
16161 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16162 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
16163 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16164 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16165 return (uintptr_t)ret_conv;
16168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16169 LDKDecodeError e_conv;
16170 e_conv.inner = (void*)(e & (~1));
16171 e_conv.is_owned = (e & 1) || (e == 0);
16172 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16173 e_conv = DecodeError_clone(&e_conv);
16174 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16175 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16176 return (uintptr_t)ret_conv;
16179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16180 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
16181 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16186 if ((_res & 1) != 0) return;
16187 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16188 CHECK_ACCESS(_res_ptr);
16189 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16191 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16194 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16195 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16196 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16197 return (uintptr_t)ret_conv;
16199 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16200 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
16201 intptr_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16206 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
16207 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16208 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16209 return (uintptr_t)ret_conv;
16212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16213 LDKStaticPaymentOutputDescriptor o_conv;
16214 o_conv.inner = (void*)(o & (~1));
16215 o_conv.is_owned = (o & 1) || (o == 0);
16216 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16217 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
16218 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16219 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16220 return (uintptr_t)ret_conv;
16223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16224 LDKDecodeError e_conv;
16225 e_conv.inner = (void*)(e & (~1));
16226 e_conv.is_owned = (e & 1) || (e == 0);
16227 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16228 e_conv = DecodeError_clone(&e_conv);
16229 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16230 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16231 return (uintptr_t)ret_conv;
16234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16235 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
16236 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16241 if ((_res & 1) != 0) return;
16242 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16243 CHECK_ACCESS(_res_ptr);
16244 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16246 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16249 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16250 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16251 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16252 return (uintptr_t)ret_conv;
16254 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16255 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
16256 intptr_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16261 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
16262 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16263 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16264 return (uintptr_t)ret_conv;
16267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16268 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16269 CHECK_ACCESS(o_ptr);
16270 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
16271 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
16272 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16273 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
16274 return (uintptr_t)ret_conv;
16277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16278 LDKDecodeError e_conv;
16279 e_conv.inner = (void*)(e & (~1));
16280 e_conv.is_owned = (e & 1) || (e == 0);
16281 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16282 e_conv = DecodeError_clone(&e_conv);
16283 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16284 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
16285 return (uintptr_t)ret_conv;
16288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16289 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
16290 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16295 if ((_res & 1) != 0) return;
16296 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16297 CHECK_ACCESS(_res_ptr);
16298 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
16300 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
16303 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16304 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16305 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
16306 return (uintptr_t)ret_conv;
16308 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16309 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
16310 intptr_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16315 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
16316 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16317 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
16318 return (uintptr_t)ret_conv;
16321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16322 LDKCVec_PaymentPreimageZ _res_constr;
16323 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16324 if (_res_constr.datalen > 0)
16325 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
16327 _res_constr.data = NULL;
16328 for (size_t i = 0; i < _res_constr.datalen; i++) {
16329 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16330 LDKThirtyTwoBytes _res_conv_8_ref;
16331 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
16332 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
16333 _res_constr.data[i] = _res_conv_8_ref;
16335 CVec_PaymentPreimageZ_free(_res_constr);
16338 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
16339 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16340 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
16341 return ((uintptr_t)ret_conv);
16343 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16344 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
16345 intptr_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
16349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16350 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
16351 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16352 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
16353 return ((uintptr_t)ret_conv);
16356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
16357 LDKSignature a_ref;
16358 CHECK((*env)->GetArrayLength(env, a) == 64);
16359 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
16360 LDKCVec_SignatureZ b_constr;
16361 b_constr.datalen = (*env)->GetArrayLength(env, b);
16362 if (b_constr.datalen > 0)
16363 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16365 b_constr.data = NULL;
16366 for (size_t i = 0; i < b_constr.datalen; i++) {
16367 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
16368 LDKSignature b_conv_8_ref;
16369 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
16370 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
16371 b_constr.data[i] = b_conv_8_ref;
16373 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16374 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
16375 return ((uintptr_t)ret_conv);
16378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16379 if ((_res & 1) != 0) return;
16380 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16381 CHECK_ACCESS(_res_ptr);
16382 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
16384 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
16387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16388 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16389 CHECK_ACCESS(o_ptr);
16390 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
16391 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
16392 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16393 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
16394 return (uintptr_t)ret_conv;
16397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
16398 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16399 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
16400 return (uintptr_t)ret_conv;
16403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16404 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
16405 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
16409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16410 if ((_res & 1) != 0) return;
16411 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16412 CHECK_ACCESS(_res_ptr);
16413 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
16415 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
16418 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
16419 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16420 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
16421 return (uintptr_t)ret_conv;
16423 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16424 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
16425 intptr_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
16429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16430 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
16431 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16432 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
16433 return (uintptr_t)ret_conv;
16436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16437 LDKSignature o_ref;
16438 CHECK((*env)->GetArrayLength(env, o) == 64);
16439 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
16440 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16441 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
16442 return (uintptr_t)ret_conv;
16445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
16446 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16447 *ret_conv = CResult_SignatureNoneZ_err();
16448 return (uintptr_t)ret_conv;
16451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16452 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
16453 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
16457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16458 if ((_res & 1) != 0) return;
16459 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16460 CHECK_ACCESS(_res_ptr);
16461 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
16463 CResult_SignatureNoneZ_free(_res_conv);
16466 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
16467 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16468 *ret_conv = CResult_SignatureNoneZ_clone(arg);
16469 return (uintptr_t)ret_conv;
16471 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16472 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
16473 intptr_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
16477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16478 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
16479 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16480 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
16481 return (uintptr_t)ret_conv;
16484 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
16485 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16486 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
16487 return ((uintptr_t)ret_conv);
16489 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16490 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
16491 intptr_t ret_val = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
16495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16496 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
16497 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16498 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
16499 return ((uintptr_t)ret_conv);
16502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
16503 LDKSignature a_ref;
16504 CHECK((*env)->GetArrayLength(env, a) == 64);
16505 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
16506 LDKSignature b_ref;
16507 CHECK((*env)->GetArrayLength(env, b) == 64);
16508 (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
16509 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16510 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
16511 return ((uintptr_t)ret_conv);
16514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16515 if ((_res & 1) != 0) return;
16516 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16517 CHECK_ACCESS(_res_ptr);
16518 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
16520 C2Tuple_SignatureSignatureZ_free(_res_conv);
16523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16524 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16525 CHECK_ACCESS(o_ptr);
16526 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
16527 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
16528 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16529 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
16530 return (uintptr_t)ret_conv;
16533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
16534 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16535 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
16536 return (uintptr_t)ret_conv;
16539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16540 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
16541 jboolean ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
16545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16546 if ((_res & 1) != 0) return;
16547 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16548 CHECK_ACCESS(_res_ptr);
16549 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
16551 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
16554 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
16555 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16556 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
16557 return (uintptr_t)ret_conv;
16559 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16560 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
16561 intptr_t ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
16565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16566 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
16567 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16568 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
16569 return (uintptr_t)ret_conv;
16572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16573 LDKSecretKey o_ref;
16574 CHECK((*env)->GetArrayLength(env, o) == 32);
16575 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
16576 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
16577 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
16578 return (uintptr_t)ret_conv;
16581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
16582 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
16583 *ret_conv = CResult_SecretKeyNoneZ_err();
16584 return (uintptr_t)ret_conv;
16587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16588 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
16589 jboolean ret_val = CResult_SecretKeyNoneZ_is_ok(o_conv);
16593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16594 if ((_res & 1) != 0) return;
16595 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16596 CHECK_ACCESS(_res_ptr);
16597 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
16599 CResult_SecretKeyNoneZ_free(_res_conv);
16602 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
16603 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
16604 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
16605 return (uintptr_t)ret_conv;
16607 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16608 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
16609 intptr_t ret_val = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
16613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16614 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
16615 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
16616 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
16617 return (uintptr_t)ret_conv;
16620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16621 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16622 CHECK_ACCESS(o_ptr);
16623 LDKSign o_conv = *(LDKSign*)(o_ptr);
16624 if (o_conv.free == LDKSign_JCalls_free) {
16625 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16626 LDKSign_JCalls_cloned(&o_conv);
16628 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16629 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
16630 return (uintptr_t)ret_conv;
16633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16634 LDKDecodeError e_conv;
16635 e_conv.inner = (void*)(e & (~1));
16636 e_conv.is_owned = (e & 1) || (e == 0);
16637 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16638 e_conv = DecodeError_clone(&e_conv);
16639 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16640 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
16641 return (uintptr_t)ret_conv;
16644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16645 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
16646 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
16650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16651 if ((_res & 1) != 0) return;
16652 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16653 CHECK_ACCESS(_res_ptr);
16654 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
16656 CResult_SignDecodeErrorZ_free(_res_conv);
16659 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
16660 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16661 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
16662 return (uintptr_t)ret_conv;
16664 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16665 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
16666 intptr_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
16670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16671 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
16672 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16673 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
16674 return (uintptr_t)ret_conv;
16677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16678 LDKCVec_u5Z _res_constr;
16679 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16680 if (_res_constr.datalen > 0)
16681 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
16683 _res_constr.data = NULL;
16684 int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
16685 for (size_t h = 0; h < _res_constr.datalen; h++) {
16686 int8_t _res_conv_7 = _res_vals[h];
16688 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
16690 (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
16691 CVec_u5Z_free(_res_constr);
16694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16695 LDKRecoverableSignature o_ref;
16696 CHECK((*env)->GetArrayLength(env, o) == 68);
16697 (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
16698 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16699 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16700 return (uintptr_t)ret_conv;
16703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
16704 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16705 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16706 return (uintptr_t)ret_conv;
16709 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16710 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
16711 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16716 if ((_res & 1) != 0) return;
16717 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16718 CHECK_ACCESS(_res_ptr);
16719 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16721 CResult_RecoverableSignatureNoneZ_free(_res_conv);
16724 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16725 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16726 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16727 return (uintptr_t)ret_conv;
16729 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16730 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
16731 intptr_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16736 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
16737 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16738 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16739 return (uintptr_t)ret_conv;
16742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
16743 LDKCVec_u8Z _res_ref;
16744 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
16745 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
16746 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
16747 CVec_u8Z_free(_res_ref);
16750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16751 LDKCVec_CVec_u8ZZ _res_constr;
16752 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16753 if (_res_constr.datalen > 0)
16754 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16756 _res_constr.data = NULL;
16757 for (size_t i = 0; i < _res_constr.datalen; i++) {
16758 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16759 LDKCVec_u8Z _res_conv_8_ref;
16760 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
16761 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
16762 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
16763 _res_constr.data[i] = _res_conv_8_ref;
16765 CVec_CVec_u8ZZ_free(_res_constr);
16768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
16769 LDKCVec_CVec_u8ZZ o_constr;
16770 o_constr.datalen = (*env)->GetArrayLength(env, o);
16771 if (o_constr.datalen > 0)
16772 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16774 o_constr.data = NULL;
16775 for (size_t i = 0; i < o_constr.datalen; i++) {
16776 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
16777 LDKCVec_u8Z o_conv_8_ref;
16778 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
16779 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
16780 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
16781 o_constr.data[i] = o_conv_8_ref;
16783 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16784 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16785 return (uintptr_t)ret_conv;
16788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
16789 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16790 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16791 return (uintptr_t)ret_conv;
16794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16795 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
16796 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16801 if ((_res & 1) != 0) return;
16802 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16803 CHECK_ACCESS(_res_ptr);
16804 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16806 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16809 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16810 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16811 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16812 return (uintptr_t)ret_conv;
16814 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16815 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
16816 intptr_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16821 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
16822 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16823 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16824 return (uintptr_t)ret_conv;
16827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16828 LDKInMemorySigner o_conv;
16829 o_conv.inner = (void*)(o & (~1));
16830 o_conv.is_owned = (o & 1) || (o == 0);
16831 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16832 o_conv = InMemorySigner_clone(&o_conv);
16833 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16834 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16835 return (uintptr_t)ret_conv;
16838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16839 LDKDecodeError e_conv;
16840 e_conv.inner = (void*)(e & (~1));
16841 e_conv.is_owned = (e & 1) || (e == 0);
16842 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16843 e_conv = DecodeError_clone(&e_conv);
16844 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16845 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16846 return (uintptr_t)ret_conv;
16849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16850 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
16851 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16856 if ((_res & 1) != 0) return;
16857 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16858 CHECK_ACCESS(_res_ptr);
16859 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16861 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16864 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16865 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16866 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16867 return (uintptr_t)ret_conv;
16869 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16870 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
16871 intptr_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16876 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
16877 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16878 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16879 return (uintptr_t)ret_conv;
16882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16883 LDKCVec_TxOutZ _res_constr;
16884 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16885 if (_res_constr.datalen > 0)
16886 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16888 _res_constr.data = NULL;
16889 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16890 for (size_t h = 0; h < _res_constr.datalen; h++) {
16891 int64_t _res_conv_7 = _res_vals[h];
16892 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
16893 CHECK_ACCESS(_res_conv_7_ptr);
16894 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16895 FREE((void*)_res_conv_7);
16896 _res_constr.data[h] = _res_conv_7_conv;
16898 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16899 CVec_TxOutZ_free(_res_constr);
16902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16903 LDKTransaction o_ref;
16904 o_ref.datalen = (*env)->GetArrayLength(env, o);
16905 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16906 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
16907 o_ref.data_is_owned = true;
16908 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16909 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16910 return (uintptr_t)ret_conv;
16913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
16914 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16915 *ret_conv = CResult_TransactionNoneZ_err();
16916 return (uintptr_t)ret_conv;
16919 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16920 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
16921 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
16925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16926 if ((_res & 1) != 0) return;
16927 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16928 CHECK_ACCESS(_res_ptr);
16929 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16931 CResult_TransactionNoneZ_free(_res_conv);
16934 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16935 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16936 *ret_conv = CResult_TransactionNoneZ_clone(arg);
16937 return (uintptr_t)ret_conv;
16939 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16940 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
16941 intptr_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
16945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16946 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
16947 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16948 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
16949 return (uintptr_t)ret_conv;
16952 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
16953 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16954 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
16955 return ((uintptr_t)ret_conv);
16957 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16958 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
16959 intptr_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
16963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16964 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
16965 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16966 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
16967 return ((uintptr_t)ret_conv);
16970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
16971 LDKThirtyTwoBytes a_ref;
16972 CHECK((*env)->GetArrayLength(env, a) == 32);
16973 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
16974 LDKChannelMonitor b_conv;
16975 b_conv.inner = (void*)(b & (~1));
16976 b_conv.is_owned = (b & 1) || (b == 0);
16977 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16978 b_conv = ChannelMonitor_clone(&b_conv);
16979 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16980 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
16981 return ((uintptr_t)ret_conv);
16984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16985 if ((_res & 1) != 0) return;
16986 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16987 CHECK_ACCESS(_res_ptr);
16988 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
16990 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
16993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16994 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
16995 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16996 if (_res_constr.datalen > 0)
16997 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
16999 _res_constr.data = NULL;
17000 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17001 for (size_t j = 0; j < _res_constr.datalen; j++) {
17002 int64_t _res_conv_35 = _res_vals[j];
17003 void* _res_conv_35_ptr = (void*)(((uintptr_t)_res_conv_35) & ~1);
17004 CHECK_ACCESS(_res_conv_35_ptr);
17005 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
17006 FREE((void*)_res_conv_35);
17007 _res_constr.data[j] = _res_conv_35_conv;
17009 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17010 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
17013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
17014 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
17015 o_constr.datalen = (*env)->GetArrayLength(env, o);
17016 if (o_constr.datalen > 0)
17017 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
17019 o_constr.data = NULL;
17020 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
17021 for (size_t j = 0; j < o_constr.datalen; j++) {
17022 int64_t o_conv_35 = o_vals[j];
17023 void* o_conv_35_ptr = (void*)(((uintptr_t)o_conv_35) & ~1);
17024 CHECK_ACCESS(o_conv_35_ptr);
17025 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
17026 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o_conv_35) & ~1));
17027 o_constr.data[j] = o_conv_35_conv;
17029 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
17030 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17031 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
17032 return (uintptr_t)ret_conv;
17035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17036 LDKIOError e_conv = LDKIOError_from_java(env, e);
17037 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17038 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
17039 return (uintptr_t)ret_conv;
17042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17043 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
17044 jboolean ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
17048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17049 if ((_res & 1) != 0) return;
17050 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17051 CHECK_ACCESS(_res_ptr);
17052 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
17054 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
17057 static inline uintptr_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
17058 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17059 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
17060 return (uintptr_t)ret_conv;
17062 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17063 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
17064 intptr_t ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
17068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17069 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
17070 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17071 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
17072 return (uintptr_t)ret_conv;
17075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
17076 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17077 *ret_copy = COption_u16Z_some(o);
17078 uintptr_t ret_ref = (uintptr_t)ret_copy;
17082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
17083 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17084 *ret_copy = COption_u16Z_none();
17085 uintptr_t ret_ref = (uintptr_t)ret_copy;
17089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
17090 if ((_res & 1) != 0) return;
17091 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17092 CHECK_ACCESS(_res_ptr);
17093 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
17095 COption_u16Z_free(_res_conv);
17098 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
17099 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17100 *ret_copy = COption_u16Z_clone(arg);
17101 uintptr_t ret_ref = (uintptr_t)ret_copy;
17104 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17105 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
17106 intptr_t ret_val = COption_u16Z_clone_ptr(arg_conv);
17110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17111 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
17112 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17113 *ret_copy = COption_u16Z_clone(orig_conv);
17114 uintptr_t ret_ref = (uintptr_t)ret_copy;
17118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
17119 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17120 *ret_conv = CResult_NoneAPIErrorZ_ok();
17121 return (uintptr_t)ret_conv;
17124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17125 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17126 CHECK_ACCESS(e_ptr);
17127 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17128 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17129 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17130 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
17131 return (uintptr_t)ret_conv;
17134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17135 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
17136 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
17140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17141 if ((_res & 1) != 0) return;
17142 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17143 CHECK_ACCESS(_res_ptr);
17144 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
17146 CResult_NoneAPIErrorZ_free(_res_conv);
17149 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
17150 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17151 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
17152 return (uintptr_t)ret_conv;
17154 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17155 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
17156 intptr_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
17160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17161 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
17162 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17163 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
17164 return (uintptr_t)ret_conv;
17167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17168 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
17169 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17170 if (_res_constr.datalen > 0)
17171 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17173 _res_constr.data = NULL;
17174 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17175 for (size_t w = 0; w < _res_constr.datalen; w++) {
17176 int64_t _res_conv_22 = _res_vals[w];
17177 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
17178 CHECK_ACCESS(_res_conv_22_ptr);
17179 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
17180 FREE((void*)_res_conv_22);
17181 _res_constr.data[w] = _res_conv_22_conv;
17183 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17184 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
17187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17188 LDKCVec_APIErrorZ _res_constr;
17189 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17190 if (_res_constr.datalen > 0)
17191 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
17193 _res_constr.data = NULL;
17194 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17195 for (size_t k = 0; k < _res_constr.datalen; k++) {
17196 int64_t _res_conv_10 = _res_vals[k];
17197 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
17198 CHECK_ACCESS(_res_conv_10_ptr);
17199 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
17200 FREE((void*)_res_conv_10);
17201 _res_constr.data[k] = _res_conv_10_conv;
17203 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17204 CVec_APIErrorZ_free(_res_constr);
17207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17208 LDKThirtyTwoBytes o_ref;
17209 CHECK((*env)->GetArrayLength(env, o) == 32);
17210 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17211 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17212 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
17213 return (uintptr_t)ret_conv;
17216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17217 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17218 CHECK_ACCESS(e_ptr);
17219 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17220 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17221 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17222 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
17223 return (uintptr_t)ret_conv;
17226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17227 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
17228 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
17232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_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__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
17238 CResult__u832APIErrorZ_free(_res_conv);
17241 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
17242 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17243 *ret_conv = CResult__u832APIErrorZ_clone(arg);
17244 return (uintptr_t)ret_conv;
17246 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17247 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
17248 intptr_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
17252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17253 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
17254 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17255 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
17256 return (uintptr_t)ret_conv;
17259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17260 LDKThirtyTwoBytes o_ref;
17261 CHECK((*env)->GetArrayLength(env, o) == 32);
17262 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17263 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17264 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
17265 return (uintptr_t)ret_conv;
17268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17269 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17270 CHECK_ACCESS(e_ptr);
17271 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17272 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17273 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17274 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
17275 return (uintptr_t)ret_conv;
17278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17279 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
17280 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
17284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17285 if ((_res & 1) != 0) return;
17286 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17287 CHECK_ACCESS(_res_ptr);
17288 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
17290 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
17293 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
17294 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17295 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
17296 return (uintptr_t)ret_conv;
17298 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17299 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
17300 intptr_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
17304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17305 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
17306 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17307 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
17308 return (uintptr_t)ret_conv;
17311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
17312 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17313 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
17314 return (uintptr_t)ret_conv;
17317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17318 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17319 CHECK_ACCESS(e_ptr);
17320 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17321 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17322 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17323 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
17324 return (uintptr_t)ret_conv;
17327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17328 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
17329 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
17333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17334 if ((_res & 1) != 0) return;
17335 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17336 CHECK_ACCESS(_res_ptr);
17337 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
17339 CResult_NonePaymentSendFailureZ_free(_res_conv);
17342 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
17343 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17344 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
17345 return (uintptr_t)ret_conv;
17347 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17348 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
17349 intptr_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
17353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17354 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
17355 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17356 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
17357 return (uintptr_t)ret_conv;
17360 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
17361 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17362 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
17363 return ((uintptr_t)ret_conv);
17365 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17366 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
17367 intptr_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
17371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17372 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
17373 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17374 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
17375 return ((uintptr_t)ret_conv);
17378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17379 LDKThirtyTwoBytes a_ref;
17380 CHECK((*env)->GetArrayLength(env, a) == 32);
17381 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17382 LDKThirtyTwoBytes b_ref;
17383 CHECK((*env)->GetArrayLength(env, b) == 32);
17384 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
17385 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17386 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
17387 return ((uintptr_t)ret_conv);
17390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17391 if ((_res & 1) != 0) return;
17392 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17393 CHECK_ACCESS(_res_ptr);
17394 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
17396 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
17399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17400 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17401 CHECK_ACCESS(o_ptr);
17402 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
17403 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
17404 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17405 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
17406 return (uintptr_t)ret_conv;
17409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17410 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17411 CHECK_ACCESS(e_ptr);
17412 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17413 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17414 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17415 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
17416 return (uintptr_t)ret_conv;
17419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17420 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
17421 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
17425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17426 if ((_res & 1) != 0) return;
17427 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17428 CHECK_ACCESS(_res_ptr);
17429 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
17431 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
17434 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
17435 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17436 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
17437 return (uintptr_t)ret_conv;
17439 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17440 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
17441 intptr_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
17445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17446 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
17447 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17448 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
17449 return (uintptr_t)ret_conv;
17452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17453 LDKCVec_NetAddressZ _res_constr;
17454 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17455 if (_res_constr.datalen > 0)
17456 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17458 _res_constr.data = NULL;
17459 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17460 for (size_t m = 0; m < _res_constr.datalen; m++) {
17461 int64_t _res_conv_12 = _res_vals[m];
17462 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
17463 CHECK_ACCESS(_res_conv_12_ptr);
17464 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
17465 FREE((void*)_res_conv_12);
17466 _res_constr.data[m] = _res_conv_12_conv;
17468 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17469 CVec_NetAddressZ_free(_res_constr);
17472 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
17473 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17474 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
17475 return ((uintptr_t)ret_conv);
17477 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17478 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
17479 intptr_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
17483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17484 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
17485 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17486 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
17487 return ((uintptr_t)ret_conv);
17490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17491 LDKThirtyTwoBytes a_ref;
17492 CHECK((*env)->GetArrayLength(env, a) == 32);
17493 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17494 LDKThirtyTwoBytes b_ref;
17495 CHECK((*env)->GetArrayLength(env, b) == 32);
17496 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
17497 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17498 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
17499 return ((uintptr_t)ret_conv);
17502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17503 if ((_res & 1) != 0) return;
17504 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17505 CHECK_ACCESS(_res_ptr);
17506 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
17508 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
17511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17512 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17513 CHECK_ACCESS(o_ptr);
17514 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17515 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
17516 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17517 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
17518 return (uintptr_t)ret_conv;
17521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
17522 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17523 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
17524 return (uintptr_t)ret_conv;
17527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17528 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
17529 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
17533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17534 if ((_res & 1) != 0) return;
17535 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17536 CHECK_ACCESS(_res_ptr);
17537 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
17539 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
17542 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
17543 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17544 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
17545 return (uintptr_t)ret_conv;
17547 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17548 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
17549 intptr_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
17553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17554 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
17555 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17556 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
17557 return (uintptr_t)ret_conv;
17560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17561 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17562 CHECK_ACCESS(o_ptr);
17563 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17564 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
17565 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17566 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
17567 return (uintptr_t)ret_conv;
17570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17571 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17572 CHECK_ACCESS(e_ptr);
17573 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17574 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17575 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17576 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
17577 return (uintptr_t)ret_conv;
17580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17581 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
17582 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
17586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17587 if ((_res & 1) != 0) return;
17588 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17589 CHECK_ACCESS(_res_ptr);
17590 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
17592 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
17595 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
17596 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17597 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
17598 return (uintptr_t)ret_conv;
17600 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17601 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
17602 intptr_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
17606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17607 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
17608 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17609 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
17610 return (uintptr_t)ret_conv;
17613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17614 LDKThirtyTwoBytes o_ref;
17615 CHECK((*env)->GetArrayLength(env, o) == 32);
17616 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17617 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17618 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
17619 return (uintptr_t)ret_conv;
17622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
17623 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17624 *ret_conv = CResult_PaymentSecretNoneZ_err();
17625 return (uintptr_t)ret_conv;
17628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17629 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
17630 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
17634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17635 if ((_res & 1) != 0) return;
17636 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17637 CHECK_ACCESS(_res_ptr);
17638 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
17640 CResult_PaymentSecretNoneZ_free(_res_conv);
17643 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
17644 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17645 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
17646 return (uintptr_t)ret_conv;
17648 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17649 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
17650 intptr_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
17654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17655 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
17656 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17657 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
17658 return (uintptr_t)ret_conv;
17661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17662 LDKThirtyTwoBytes o_ref;
17663 CHECK((*env)->GetArrayLength(env, o) == 32);
17664 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17665 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17666 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
17667 return (uintptr_t)ret_conv;
17670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17671 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17672 CHECK_ACCESS(e_ptr);
17673 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17674 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17675 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17676 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
17677 return (uintptr_t)ret_conv;
17680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17681 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
17682 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
17686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17687 if ((_res & 1) != 0) return;
17688 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17689 CHECK_ACCESS(_res_ptr);
17690 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
17692 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
17695 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
17696 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17697 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
17698 return (uintptr_t)ret_conv;
17700 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17701 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
17702 intptr_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
17706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17707 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
17708 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17709 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
17710 return (uintptr_t)ret_conv;
17713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17714 LDKThirtyTwoBytes o_ref;
17715 CHECK((*env)->GetArrayLength(env, o) == 32);
17716 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17717 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17718 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
17719 return (uintptr_t)ret_conv;
17722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17723 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17724 CHECK_ACCESS(e_ptr);
17725 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17726 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17727 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17728 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
17729 return (uintptr_t)ret_conv;
17732 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17733 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
17734 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
17738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17739 if ((_res & 1) != 0) return;
17740 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17741 CHECK_ACCESS(_res_ptr);
17742 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
17744 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
17747 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
17748 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17749 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
17750 return (uintptr_t)ret_conv;
17752 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17753 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
17754 intptr_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
17758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17759 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
17760 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17761 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
17762 return (uintptr_t)ret_conv;
17765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17766 LDKCounterpartyForwardingInfo o_conv;
17767 o_conv.inner = (void*)(o & (~1));
17768 o_conv.is_owned = (o & 1) || (o == 0);
17769 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17770 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
17771 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17772 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
17773 return (uintptr_t)ret_conv;
17776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17777 LDKDecodeError e_conv;
17778 e_conv.inner = (void*)(e & (~1));
17779 e_conv.is_owned = (e & 1) || (e == 0);
17780 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17781 e_conv = DecodeError_clone(&e_conv);
17782 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17783 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
17784 return (uintptr_t)ret_conv;
17787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17788 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
17789 jboolean ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
17793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17794 if ((_res & 1) != 0) return;
17795 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17796 CHECK_ACCESS(_res_ptr);
17797 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
17799 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
17802 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
17803 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17804 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
17805 return (uintptr_t)ret_conv;
17807 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17808 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
17809 intptr_t ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
17813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17814 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
17815 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17816 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
17817 return (uintptr_t)ret_conv;
17820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17821 LDKChannelCounterparty o_conv;
17822 o_conv.inner = (void*)(o & (~1));
17823 o_conv.is_owned = (o & 1) || (o == 0);
17824 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17825 o_conv = ChannelCounterparty_clone(&o_conv);
17826 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17827 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
17828 return (uintptr_t)ret_conv;
17831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17832 LDKDecodeError e_conv;
17833 e_conv.inner = (void*)(e & (~1));
17834 e_conv.is_owned = (e & 1) || (e == 0);
17835 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17836 e_conv = DecodeError_clone(&e_conv);
17837 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17838 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
17839 return (uintptr_t)ret_conv;
17842 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17843 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
17844 jboolean ret_val = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
17848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17849 if ((_res & 1) != 0) return;
17850 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17851 CHECK_ACCESS(_res_ptr);
17852 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
17854 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
17857 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
17858 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17859 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
17860 return (uintptr_t)ret_conv;
17862 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17863 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
17864 intptr_t ret_val = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
17868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17869 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
17870 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17871 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
17872 return (uintptr_t)ret_conv;
17875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17876 LDKChannelDetails o_conv;
17877 o_conv.inner = (void*)(o & (~1));
17878 o_conv.is_owned = (o & 1) || (o == 0);
17879 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17880 o_conv = ChannelDetails_clone(&o_conv);
17881 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17882 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
17883 return (uintptr_t)ret_conv;
17886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17887 LDKDecodeError e_conv;
17888 e_conv.inner = (void*)(e & (~1));
17889 e_conv.is_owned = (e & 1) || (e == 0);
17890 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17891 e_conv = DecodeError_clone(&e_conv);
17892 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17893 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
17894 return (uintptr_t)ret_conv;
17897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17898 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
17899 jboolean ret_val = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
17903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17904 if ((_res & 1) != 0) return;
17905 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17906 CHECK_ACCESS(_res_ptr);
17907 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
17909 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
17912 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
17913 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17914 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
17915 return (uintptr_t)ret_conv;
17917 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17918 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
17919 intptr_t ret_val = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
17923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17924 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
17925 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17926 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
17927 return (uintptr_t)ret_conv;
17930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17931 LDKPhantomRouteHints o_conv;
17932 o_conv.inner = (void*)(o & (~1));
17933 o_conv.is_owned = (o & 1) || (o == 0);
17934 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17935 o_conv = PhantomRouteHints_clone(&o_conv);
17936 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17937 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
17938 return (uintptr_t)ret_conv;
17941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17942 LDKDecodeError e_conv;
17943 e_conv.inner = (void*)(e & (~1));
17944 e_conv.is_owned = (e & 1) || (e == 0);
17945 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17946 e_conv = DecodeError_clone(&e_conv);
17947 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17948 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
17949 return (uintptr_t)ret_conv;
17952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17953 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
17954 jboolean ret_val = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
17958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17959 if ((_res & 1) != 0) return;
17960 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17961 CHECK_ACCESS(_res_ptr);
17962 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
17964 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
17967 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
17968 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17969 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
17970 return (uintptr_t)ret_conv;
17972 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17973 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
17974 intptr_t ret_val = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
17978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17979 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
17980 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17981 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
17982 return (uintptr_t)ret_conv;
17985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17986 LDKCVec_ChannelMonitorZ _res_constr;
17987 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17988 if (_res_constr.datalen > 0)
17989 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17991 _res_constr.data = NULL;
17992 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17993 for (size_t q = 0; q < _res_constr.datalen; q++) {
17994 int64_t _res_conv_16 = _res_vals[q];
17995 LDKChannelMonitor _res_conv_16_conv;
17996 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
17997 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
17998 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17999 _res_constr.data[q] = _res_conv_16_conv;
18001 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18002 CVec_ChannelMonitorZ_free(_res_constr);
18005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
18006 LDKThirtyTwoBytes a_ref;
18007 CHECK((*env)->GetArrayLength(env, a) == 32);
18008 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18009 LDKChannelManager b_conv;
18010 b_conv.inner = (void*)(b & (~1));
18011 b_conv.is_owned = (b & 1) || (b == 0);
18012 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18013 // WARNING: we need a move here but no clone is available for LDKChannelManager
18014 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
18015 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
18016 return ((uintptr_t)ret_conv);
18019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18020 if ((_res & 1) != 0) return;
18021 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18022 CHECK_ACCESS(_res_ptr);
18023 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
18025 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
18028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18029 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18030 CHECK_ACCESS(o_ptr);
18031 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
18032 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
18033 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18034 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
18035 return (uintptr_t)ret_conv;
18038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18039 LDKDecodeError e_conv;
18040 e_conv.inner = (void*)(e & (~1));
18041 e_conv.is_owned = (e & 1) || (e == 0);
18042 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18043 e_conv = DecodeError_clone(&e_conv);
18044 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18045 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
18046 return (uintptr_t)ret_conv;
18049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18050 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
18051 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
18055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18056 if ((_res & 1) != 0) return;
18057 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18058 CHECK_ACCESS(_res_ptr);
18059 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
18061 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
18064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18065 LDKChannelConfig o_conv;
18066 o_conv.inner = (void*)(o & (~1));
18067 o_conv.is_owned = (o & 1) || (o == 0);
18068 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18069 o_conv = ChannelConfig_clone(&o_conv);
18070 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18071 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
18072 return (uintptr_t)ret_conv;
18075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18076 LDKDecodeError e_conv;
18077 e_conv.inner = (void*)(e & (~1));
18078 e_conv.is_owned = (e & 1) || (e == 0);
18079 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18080 e_conv = DecodeError_clone(&e_conv);
18081 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18082 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
18083 return (uintptr_t)ret_conv;
18086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18087 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
18088 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
18092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18093 if ((_res & 1) != 0) return;
18094 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18095 CHECK_ACCESS(_res_ptr);
18096 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
18098 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
18101 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
18102 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18103 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
18104 return (uintptr_t)ret_conv;
18106 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18107 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
18108 intptr_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
18112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18113 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
18114 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18115 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
18116 return (uintptr_t)ret_conv;
18119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18120 LDKOutPoint o_conv;
18121 o_conv.inner = (void*)(o & (~1));
18122 o_conv.is_owned = (o & 1) || (o == 0);
18123 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18124 o_conv = OutPoint_clone(&o_conv);
18125 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18126 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
18127 return (uintptr_t)ret_conv;
18130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18131 LDKDecodeError e_conv;
18132 e_conv.inner = (void*)(e & (~1));
18133 e_conv.is_owned = (e & 1) || (e == 0);
18134 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18135 e_conv = DecodeError_clone(&e_conv);
18136 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18137 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
18138 return (uintptr_t)ret_conv;
18141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18142 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
18143 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
18147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18148 if ((_res & 1) != 0) return;
18149 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18150 CHECK_ACCESS(_res_ptr);
18151 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
18153 CResult_OutPointDecodeErrorZ_free(_res_conv);
18156 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
18157 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18158 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
18159 return (uintptr_t)ret_conv;
18161 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18162 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
18163 intptr_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
18167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18168 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
18169 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18170 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
18171 return (uintptr_t)ret_conv;
18174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18175 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18176 CHECK_ACCESS(o_ptr);
18177 LDKType o_conv = *(LDKType*)(o_ptr);
18178 if (o_conv.free == LDKType_JCalls_free) {
18179 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18180 LDKType_JCalls_cloned(&o_conv);
18182 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18183 *ret_copy = COption_TypeZ_some(o_conv);
18184 uintptr_t ret_ref = (uintptr_t)ret_copy;
18188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
18189 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18190 *ret_copy = COption_TypeZ_none();
18191 uintptr_t ret_ref = (uintptr_t)ret_copy;
18195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18196 if ((_res & 1) != 0) return;
18197 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18198 CHECK_ACCESS(_res_ptr);
18199 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
18201 COption_TypeZ_free(_res_conv);
18204 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
18205 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18206 *ret_copy = COption_TypeZ_clone(arg);
18207 uintptr_t ret_ref = (uintptr_t)ret_copy;
18210 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18211 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
18212 intptr_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
18216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18217 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
18218 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18219 *ret_copy = COption_TypeZ_clone(orig_conv);
18220 uintptr_t ret_ref = (uintptr_t)ret_copy;
18224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18225 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18226 CHECK_ACCESS(o_ptr);
18227 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
18228 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
18229 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18230 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
18231 return (uintptr_t)ret_conv;
18234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18235 LDKDecodeError e_conv;
18236 e_conv.inner = (void*)(e & (~1));
18237 e_conv.is_owned = (e & 1) || (e == 0);
18238 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18239 e_conv = DecodeError_clone(&e_conv);
18240 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18241 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
18242 return (uintptr_t)ret_conv;
18245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18246 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
18247 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
18251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18252 if ((_res & 1) != 0) return;
18253 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18254 CHECK_ACCESS(_res_ptr);
18255 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
18257 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
18260 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
18261 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18262 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
18263 return (uintptr_t)ret_conv;
18265 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18266 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
18267 intptr_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
18271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18272 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
18273 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18274 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
18275 return (uintptr_t)ret_conv;
18278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18279 LDKThirtyTwoBytes o_ref;
18280 CHECK((*env)->GetArrayLength(env, o) == 32);
18281 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18282 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18283 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
18284 return (uintptr_t)ret_conv;
18287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18288 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18289 CHECK_ACCESS(e_ptr);
18290 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18291 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
18292 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18293 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
18294 return (uintptr_t)ret_conv;
18297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18298 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
18299 jboolean ret_val = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
18303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18304 if ((_res & 1) != 0) return;
18305 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18306 CHECK_ACCESS(_res_ptr);
18307 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
18309 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
18312 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
18313 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18314 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
18315 return (uintptr_t)ret_conv;
18317 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18318 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
18319 intptr_t ret_val = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
18323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18324 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
18325 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18326 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
18327 return (uintptr_t)ret_conv;
18330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
18331 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
18332 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
18333 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
18334 return (uintptr_t)ret_conv;
18337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
18338 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
18339 *ret_conv = CResult_SiPrefixNoneZ_err();
18340 return (uintptr_t)ret_conv;
18343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18344 LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1);
18345 jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv);
18349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18350 if ((_res & 1) != 0) return;
18351 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18352 CHECK_ACCESS(_res_ptr);
18353 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
18355 CResult_SiPrefixNoneZ_free(_res_conv);
18358 static inline uintptr_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) {
18359 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
18360 *ret_conv = CResult_SiPrefixNoneZ_clone(arg);
18361 return (uintptr_t)ret_conv;
18363 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18364 LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
18365 intptr_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv);
18369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18370 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
18371 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
18372 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
18373 return (uintptr_t)ret_conv;
18376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18378 o_conv.inner = (void*)(o & (~1));
18379 o_conv.is_owned = (o & 1) || (o == 0);
18380 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18381 o_conv = Invoice_clone(&o_conv);
18382 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
18383 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
18384 return (uintptr_t)ret_conv;
18387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
18388 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
18389 *ret_conv = CResult_InvoiceNoneZ_err();
18390 return (uintptr_t)ret_conv;
18393 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18394 LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1);
18395 jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv);
18399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18400 if ((_res & 1) != 0) return;
18401 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18402 CHECK_ACCESS(_res_ptr);
18403 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
18405 CResult_InvoiceNoneZ_free(_res_conv);
18408 static inline uintptr_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) {
18409 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
18410 *ret_conv = CResult_InvoiceNoneZ_clone(arg);
18411 return (uintptr_t)ret_conv;
18413 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18414 LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
18415 intptr_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv);
18419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18420 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
18421 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
18422 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
18423 return (uintptr_t)ret_conv;
18426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18427 LDKSignedRawInvoice o_conv;
18428 o_conv.inner = (void*)(o & (~1));
18429 o_conv.is_owned = (o & 1) || (o == 0);
18430 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18431 o_conv = SignedRawInvoice_clone(&o_conv);
18432 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
18433 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
18434 return (uintptr_t)ret_conv;
18437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
18438 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
18439 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
18440 return (uintptr_t)ret_conv;
18443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18444 LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1);
18445 jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv);
18449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18450 if ((_res & 1) != 0) return;
18451 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18452 CHECK_ACCESS(_res_ptr);
18453 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
18455 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
18458 static inline uintptr_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) {
18459 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
18460 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg);
18461 return (uintptr_t)ret_conv;
18463 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18464 LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
18465 intptr_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv);
18469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18470 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
18471 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
18472 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
18473 return (uintptr_t)ret_conv;
18476 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
18477 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18478 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
18479 return ((uintptr_t)ret_conv);
18481 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18482 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
18483 intptr_t ret_val = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
18487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18488 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
18489 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18490 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
18491 return ((uintptr_t)ret_conv);
18494 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) {
18495 LDKRawInvoice a_conv;
18496 a_conv.inner = (void*)(a & (~1));
18497 a_conv.is_owned = (a & 1) || (a == 0);
18498 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18499 a_conv = RawInvoice_clone(&a_conv);
18500 LDKThirtyTwoBytes b_ref;
18501 CHECK((*env)->GetArrayLength(env, b) == 32);
18502 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
18503 LDKInvoiceSignature c_conv;
18504 c_conv.inner = (void*)(c & (~1));
18505 c_conv.is_owned = (c & 1) || (c == 0);
18506 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
18507 c_conv = InvoiceSignature_clone(&c_conv);
18508 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18509 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
18510 return ((uintptr_t)ret_conv);
18513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18514 if ((_res & 1) != 0) return;
18515 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18516 CHECK_ACCESS(_res_ptr);
18517 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
18519 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
18522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18523 LDKPayeePubKey o_conv;
18524 o_conv.inner = (void*)(o & (~1));
18525 o_conv.is_owned = (o & 1) || (o == 0);
18526 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18527 o_conv = PayeePubKey_clone(&o_conv);
18528 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18529 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
18530 return (uintptr_t)ret_conv;
18533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18534 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
18535 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18536 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
18537 return (uintptr_t)ret_conv;
18540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18541 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
18542 jboolean ret_val = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
18546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18547 if ((_res & 1) != 0) return;
18548 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18549 CHECK_ACCESS(_res_ptr);
18550 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
18552 CResult_PayeePubKeyErrorZ_free(_res_conv);
18555 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
18556 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18557 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
18558 return (uintptr_t)ret_conv;
18560 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18561 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
18562 intptr_t ret_val = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
18566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18567 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
18568 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18569 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
18570 return (uintptr_t)ret_conv;
18573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18574 LDKCVec_PrivateRouteZ _res_constr;
18575 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18576 if (_res_constr.datalen > 0)
18577 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
18579 _res_constr.data = NULL;
18580 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18581 for (size_t o = 0; o < _res_constr.datalen; o++) {
18582 int64_t _res_conv_14 = _res_vals[o];
18583 LDKPrivateRoute _res_conv_14_conv;
18584 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
18585 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
18586 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
18587 _res_constr.data[o] = _res_conv_14_conv;
18589 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18590 CVec_PrivateRouteZ_free(_res_constr);
18593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18594 LDKPositiveTimestamp o_conv;
18595 o_conv.inner = (void*)(o & (~1));
18596 o_conv.is_owned = (o & 1) || (o == 0);
18597 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18598 o_conv = PositiveTimestamp_clone(&o_conv);
18599 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
18600 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
18601 return (uintptr_t)ret_conv;
18604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18605 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
18606 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
18607 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
18608 return (uintptr_t)ret_conv;
18611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18612 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
18613 jboolean ret_val = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
18617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18618 if ((_res & 1) != 0) return;
18619 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18620 CHECK_ACCESS(_res_ptr);
18621 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
18623 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
18626 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
18627 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
18628 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
18629 return (uintptr_t)ret_conv;
18631 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18632 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
18633 intptr_t ret_val = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
18637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18638 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
18639 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
18640 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
18641 return (uintptr_t)ret_conv;
18644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
18645 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
18646 *ret_conv = CResult_NoneSemanticErrorZ_ok();
18647 return (uintptr_t)ret_conv;
18650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18651 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
18652 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
18653 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
18654 return (uintptr_t)ret_conv;
18657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18658 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
18659 jboolean ret_val = CResult_NoneSemanticErrorZ_is_ok(o_conv);
18663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18664 if ((_res & 1) != 0) return;
18665 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18666 CHECK_ACCESS(_res_ptr);
18667 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
18669 CResult_NoneSemanticErrorZ_free(_res_conv);
18672 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
18673 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
18674 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
18675 return (uintptr_t)ret_conv;
18677 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18678 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
18679 intptr_t ret_val = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
18683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18684 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
18685 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
18686 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
18687 return (uintptr_t)ret_conv;
18690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18692 o_conv.inner = (void*)(o & (~1));
18693 o_conv.is_owned = (o & 1) || (o == 0);
18694 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18695 o_conv = Invoice_clone(&o_conv);
18696 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
18697 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
18698 return (uintptr_t)ret_conv;
18701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18702 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
18703 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
18704 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
18705 return (uintptr_t)ret_conv;
18708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18709 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
18710 jboolean ret_val = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
18714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18715 if ((_res & 1) != 0) return;
18716 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18717 CHECK_ACCESS(_res_ptr);
18718 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
18720 CResult_InvoiceSemanticErrorZ_free(_res_conv);
18723 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
18724 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
18725 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
18726 return (uintptr_t)ret_conv;
18728 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18729 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
18730 intptr_t ret_val = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
18734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18735 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
18736 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
18737 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
18738 return (uintptr_t)ret_conv;
18741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18742 LDKDescription o_conv;
18743 o_conv.inner = (void*)(o & (~1));
18744 o_conv.is_owned = (o & 1) || (o == 0);
18745 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18746 o_conv = Description_clone(&o_conv);
18747 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
18748 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
18749 return (uintptr_t)ret_conv;
18752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18753 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
18754 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
18755 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
18756 return (uintptr_t)ret_conv;
18759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18760 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
18761 jboolean ret_val = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
18765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18766 if ((_res & 1) != 0) return;
18767 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18768 CHECK_ACCESS(_res_ptr);
18769 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
18771 CResult_DescriptionCreationErrorZ_free(_res_conv);
18774 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
18775 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
18776 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
18777 return (uintptr_t)ret_conv;
18779 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18780 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
18781 intptr_t ret_val = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
18785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18786 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
18787 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
18788 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
18789 return (uintptr_t)ret_conv;
18792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18793 LDKPrivateRoute o_conv;
18794 o_conv.inner = (void*)(o & (~1));
18795 o_conv.is_owned = (o & 1) || (o == 0);
18796 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18797 o_conv = PrivateRoute_clone(&o_conv);
18798 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
18799 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
18800 return (uintptr_t)ret_conv;
18803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18804 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
18805 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
18806 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
18807 return (uintptr_t)ret_conv;
18810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18811 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
18812 jboolean ret_val = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
18816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18817 if ((_res & 1) != 0) return;
18818 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18819 CHECK_ACCESS(_res_ptr);
18820 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
18822 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
18825 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
18826 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
18827 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
18828 return (uintptr_t)ret_conv;
18830 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18831 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
18832 intptr_t ret_val = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
18836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18837 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
18838 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
18839 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
18840 return (uintptr_t)ret_conv;
18843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
18844 LDKStr o_conv = java_to_owned_str(env, o);
18845 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18846 *ret_conv = CResult_StringErrorZ_ok(o_conv);
18847 return (uintptr_t)ret_conv;
18850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18851 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
18852 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18853 *ret_conv = CResult_StringErrorZ_err(e_conv);
18854 return (uintptr_t)ret_conv;
18857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18858 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
18859 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
18863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18864 if ((_res & 1) != 0) return;
18865 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18866 CHECK_ACCESS(_res_ptr);
18867 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
18869 CResult_StringErrorZ_free(_res_conv);
18872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18873 LDKChannelMonitorUpdate o_conv;
18874 o_conv.inner = (void*)(o & (~1));
18875 o_conv.is_owned = (o & 1) || (o == 0);
18876 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18877 o_conv = ChannelMonitorUpdate_clone(&o_conv);
18878 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18879 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
18880 return (uintptr_t)ret_conv;
18883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18884 LDKDecodeError e_conv;
18885 e_conv.inner = (void*)(e & (~1));
18886 e_conv.is_owned = (e & 1) || (e == 0);
18887 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18888 e_conv = DecodeError_clone(&e_conv);
18889 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18890 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
18891 return (uintptr_t)ret_conv;
18894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18895 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
18896 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
18900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18901 if ((_res & 1) != 0) return;
18902 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18903 CHECK_ACCESS(_res_ptr);
18904 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
18906 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
18909 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
18910 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18911 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
18912 return (uintptr_t)ret_conv;
18914 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18915 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
18916 intptr_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
18920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18921 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
18922 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18923 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
18924 return (uintptr_t)ret_conv;
18927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18928 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18929 CHECK_ACCESS(o_ptr);
18930 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
18931 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
18932 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18933 *ret_copy = COption_MonitorEventZ_some(o_conv);
18934 uintptr_t ret_ref = (uintptr_t)ret_copy;
18938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
18939 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18940 *ret_copy = COption_MonitorEventZ_none();
18941 uintptr_t ret_ref = (uintptr_t)ret_copy;
18945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18946 if ((_res & 1) != 0) return;
18947 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18948 CHECK_ACCESS(_res_ptr);
18949 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
18951 COption_MonitorEventZ_free(_res_conv);
18954 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
18955 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18956 *ret_copy = COption_MonitorEventZ_clone(arg);
18957 uintptr_t ret_ref = (uintptr_t)ret_copy;
18960 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18961 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
18962 intptr_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
18966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18967 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
18968 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18969 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
18970 uintptr_t ret_ref = (uintptr_t)ret_copy;
18974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18975 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18976 CHECK_ACCESS(o_ptr);
18977 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
18978 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
18979 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18980 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
18981 return (uintptr_t)ret_conv;
18984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18985 LDKDecodeError e_conv;
18986 e_conv.inner = (void*)(e & (~1));
18987 e_conv.is_owned = (e & 1) || (e == 0);
18988 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18989 e_conv = DecodeError_clone(&e_conv);
18990 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18991 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
18992 return (uintptr_t)ret_conv;
18995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18996 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
18997 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
19001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19002 if ((_res & 1) != 0) return;
19003 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19004 CHECK_ACCESS(_res_ptr);
19005 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
19007 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
19010 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
19011 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19012 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
19013 return (uintptr_t)ret_conv;
19015 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19016 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
19017 intptr_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
19021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19022 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
19023 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19024 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
19025 return (uintptr_t)ret_conv;
19028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19029 LDKHTLCUpdate o_conv;
19030 o_conv.inner = (void*)(o & (~1));
19031 o_conv.is_owned = (o & 1) || (o == 0);
19032 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19033 o_conv = HTLCUpdate_clone(&o_conv);
19034 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19035 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
19036 return (uintptr_t)ret_conv;
19039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19040 LDKDecodeError e_conv;
19041 e_conv.inner = (void*)(e & (~1));
19042 e_conv.is_owned = (e & 1) || (e == 0);
19043 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19044 e_conv = DecodeError_clone(&e_conv);
19045 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19046 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
19047 return (uintptr_t)ret_conv;
19050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19051 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
19052 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
19056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19057 if ((_res & 1) != 0) return;
19058 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19059 CHECK_ACCESS(_res_ptr);
19060 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
19062 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
19065 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
19066 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19067 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
19068 return (uintptr_t)ret_conv;
19070 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19071 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
19072 intptr_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
19076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19077 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
19078 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19079 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
19080 return (uintptr_t)ret_conv;
19083 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
19084 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19085 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
19086 return ((uintptr_t)ret_conv);
19088 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19089 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
19090 intptr_t ret_val = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
19094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19095 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
19096 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19097 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
19098 return ((uintptr_t)ret_conv);
19101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
19102 LDKOutPoint a_conv;
19103 a_conv.inner = (void*)(a & (~1));
19104 a_conv.is_owned = (a & 1) || (a == 0);
19105 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19106 a_conv = OutPoint_clone(&a_conv);
19108 b_ref.datalen = (*env)->GetArrayLength(env, b);
19109 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
19110 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
19111 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19112 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
19113 return ((uintptr_t)ret_conv);
19116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19117 if ((_res & 1) != 0) return;
19118 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19119 CHECK_ACCESS(_res_ptr);
19120 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
19122 C2Tuple_OutPointScriptZ_free(_res_conv);
19125 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
19126 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19127 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
19128 return ((uintptr_t)ret_conv);
19130 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19131 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
19132 intptr_t ret_val = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
19136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19137 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
19138 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19139 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
19140 return ((uintptr_t)ret_conv);
19143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
19145 b_ref.datalen = (*env)->GetArrayLength(env, b);
19146 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
19147 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
19148 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19149 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
19150 return ((uintptr_t)ret_conv);
19153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19154 if ((_res & 1) != 0) return;
19155 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19156 CHECK_ACCESS(_res_ptr);
19157 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
19159 C2Tuple_u32ScriptZ_free(_res_conv);
19162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19163 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
19164 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19165 if (_res_constr.datalen > 0)
19166 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
19168 _res_constr.data = NULL;
19169 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19170 for (size_t v = 0; v < _res_constr.datalen; v++) {
19171 int64_t _res_conv_21 = _res_vals[v];
19172 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
19173 CHECK_ACCESS(_res_conv_21_ptr);
19174 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
19175 FREE((void*)_res_conv_21);
19176 _res_constr.data[v] = _res_conv_21_conv;
19178 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19179 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
19182 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
19183 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19184 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
19185 return ((uintptr_t)ret_conv);
19187 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19188 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
19189 intptr_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
19193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19194 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
19195 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19196 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
19197 return ((uintptr_t)ret_conv);
19200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
19201 LDKThirtyTwoBytes a_ref;
19202 CHECK((*env)->GetArrayLength(env, a) == 32);
19203 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19204 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
19205 b_constr.datalen = (*env)->GetArrayLength(env, b);
19206 if (b_constr.datalen > 0)
19207 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
19209 b_constr.data = NULL;
19210 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
19211 for (size_t v = 0; v < b_constr.datalen; v++) {
19212 int64_t b_conv_21 = b_vals[v];
19213 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
19214 CHECK_ACCESS(b_conv_21_ptr);
19215 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
19216 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
19217 b_constr.data[v] = b_conv_21_conv;
19219 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
19220 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19221 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
19222 return ((uintptr_t)ret_conv);
19225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19226 if ((_res & 1) != 0) return;
19227 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19228 CHECK_ACCESS(_res_ptr);
19229 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
19231 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
19234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19235 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
19236 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19237 if (_res_constr.datalen > 0)
19238 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
19240 _res_constr.data = NULL;
19241 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19242 for (size_t o = 0; o < _res_constr.datalen; o++) {
19243 int64_t _res_conv_40 = _res_vals[o];
19244 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
19245 CHECK_ACCESS(_res_conv_40_ptr);
19246 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
19247 FREE((void*)_res_conv_40);
19248 _res_constr.data[o] = _res_conv_40_conv;
19250 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19251 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
19254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19255 LDKCVec_EventZ _res_constr;
19256 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19257 if (_res_constr.datalen > 0)
19258 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
19260 _res_constr.data = NULL;
19261 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19262 for (size_t h = 0; h < _res_constr.datalen; h++) {
19263 int64_t _res_conv_7 = _res_vals[h];
19264 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
19265 CHECK_ACCESS(_res_conv_7_ptr);
19266 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
19267 FREE((void*)_res_conv_7);
19268 _res_constr.data[h] = _res_conv_7_conv;
19270 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19271 CVec_EventZ_free(_res_constr);
19274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19275 LDKCVec_TransactionZ _res_constr;
19276 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19277 if (_res_constr.datalen > 0)
19278 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
19280 _res_constr.data = NULL;
19281 for (size_t i = 0; i < _res_constr.datalen; i++) {
19282 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19283 LDKTransaction _res_conv_8_ref;
19284 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
19285 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
19286 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
19287 _res_conv_8_ref.data_is_owned = true;
19288 _res_constr.data[i] = _res_conv_8_ref;
19290 CVec_TransactionZ_free(_res_constr);
19293 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
19294 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19295 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
19296 return ((uintptr_t)ret_conv);
19298 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19299 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
19300 intptr_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
19304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19305 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
19306 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19307 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
19308 return ((uintptr_t)ret_conv);
19311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
19312 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
19313 CHECK_ACCESS(b_ptr);
19314 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
19315 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
19316 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19317 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
19318 return ((uintptr_t)ret_conv);
19321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19322 if ((_res & 1) != 0) return;
19323 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19324 CHECK_ACCESS(_res_ptr);
19325 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
19327 C2Tuple_u32TxOutZ_free(_res_conv);
19330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19331 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
19332 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19333 if (_res_constr.datalen > 0)
19334 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19336 _res_constr.data = NULL;
19337 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19338 for (size_t u = 0; u < _res_constr.datalen; u++) {
19339 int64_t _res_conv_20 = _res_vals[u];
19340 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
19341 CHECK_ACCESS(_res_conv_20_ptr);
19342 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
19343 FREE((void*)_res_conv_20);
19344 _res_constr.data[u] = _res_conv_20_conv;
19346 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19347 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
19350 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
19351 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19352 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
19353 return ((uintptr_t)ret_conv);
19355 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19356 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
19357 intptr_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
19361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19362 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
19363 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19364 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
19365 return ((uintptr_t)ret_conv);
19368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
19369 LDKThirtyTwoBytes a_ref;
19370 CHECK((*env)->GetArrayLength(env, a) == 32);
19371 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19372 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
19373 b_constr.datalen = (*env)->GetArrayLength(env, b);
19374 if (b_constr.datalen > 0)
19375 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19377 b_constr.data = NULL;
19378 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
19379 for (size_t u = 0; u < b_constr.datalen; u++) {
19380 int64_t b_conv_20 = b_vals[u];
19381 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
19382 CHECK_ACCESS(b_conv_20_ptr);
19383 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
19384 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
19385 b_constr.data[u] = b_conv_20_conv;
19387 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
19388 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19389 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
19390 return ((uintptr_t)ret_conv);
19393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19394 if ((_res & 1) != 0) return;
19395 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19396 CHECK_ACCESS(_res_ptr);
19397 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
19399 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
19402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19403 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
19404 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19405 if (_res_constr.datalen > 0)
19406 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
19408 _res_constr.data = NULL;
19409 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19410 for (size_t n = 0; n < _res_constr.datalen; n++) {
19411 int64_t _res_conv_39 = _res_vals[n];
19412 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
19413 CHECK_ACCESS(_res_conv_39_ptr);
19414 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
19415 FREE((void*)_res_conv_39);
19416 _res_constr.data[n] = _res_conv_39_conv;
19418 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19419 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
19422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19423 LDKCVec_BalanceZ _res_constr;
19424 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19425 if (_res_constr.datalen > 0)
19426 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
19428 _res_constr.data = NULL;
19429 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19430 for (size_t j = 0; j < _res_constr.datalen; j++) {
19431 int64_t _res_conv_9 = _res_vals[j];
19432 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
19433 CHECK_ACCESS(_res_conv_9_ptr);
19434 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
19435 FREE((void*)_res_conv_9);
19436 _res_constr.data[j] = _res_conv_9_conv;
19438 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19439 CVec_BalanceZ_free(_res_constr);
19442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19443 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19444 CHECK_ACCESS(o_ptr);
19445 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
19446 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
19447 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19448 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
19449 return (uintptr_t)ret_conv;
19452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19453 LDKDecodeError e_conv;
19454 e_conv.inner = (void*)(e & (~1));
19455 e_conv.is_owned = (e & 1) || (e == 0);
19456 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19457 e_conv = DecodeError_clone(&e_conv);
19458 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19459 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
19460 return (uintptr_t)ret_conv;
19463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19464 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
19465 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
19469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19470 if ((_res & 1) != 0) return;
19471 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19472 CHECK_ACCESS(_res_ptr);
19473 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
19475 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
19478 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
19479 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19480 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
19481 return (uintptr_t)ret_conv;
19483 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19484 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
19485 intptr_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
19489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19490 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
19491 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19492 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
19493 return (uintptr_t)ret_conv;
19496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
19497 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19498 *ret_conv = CResult_NoneLightningErrorZ_ok();
19499 return (uintptr_t)ret_conv;
19502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19503 LDKLightningError e_conv;
19504 e_conv.inner = (void*)(e & (~1));
19505 e_conv.is_owned = (e & 1) || (e == 0);
19506 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19507 e_conv = LightningError_clone(&e_conv);
19508 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19509 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
19510 return (uintptr_t)ret_conv;
19513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19514 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
19515 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
19519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19520 if ((_res & 1) != 0) return;
19521 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19522 CHECK_ACCESS(_res_ptr);
19523 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
19525 CResult_NoneLightningErrorZ_free(_res_conv);
19528 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
19529 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19530 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
19531 return (uintptr_t)ret_conv;
19533 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19534 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
19535 intptr_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
19539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19540 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
19541 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19542 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
19543 return (uintptr_t)ret_conv;
19546 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
19547 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19548 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
19549 return ((uintptr_t)ret_conv);
19551 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19552 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
19553 intptr_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
19557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19558 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
19559 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19560 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
19561 return ((uintptr_t)ret_conv);
19564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
19565 LDKPublicKey a_ref;
19566 CHECK((*env)->GetArrayLength(env, a) == 33);
19567 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
19568 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
19569 CHECK_ACCESS(b_ptr);
19570 LDKType b_conv = *(LDKType*)(b_ptr);
19571 if (b_conv.free == LDKType_JCalls_free) {
19572 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19573 LDKType_JCalls_cloned(&b_conv);
19575 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19576 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
19577 return ((uintptr_t)ret_conv);
19580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19581 if ((_res & 1) != 0) return;
19582 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19583 CHECK_ACCESS(_res_ptr);
19584 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
19586 C2Tuple_PublicKeyTypeZ_free(_res_conv);
19589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19590 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
19591 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19592 if (_res_constr.datalen > 0)
19593 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
19595 _res_constr.data = NULL;
19596 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19597 for (size_t z = 0; z < _res_constr.datalen; z++) {
19598 int64_t _res_conv_25 = _res_vals[z];
19599 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
19600 CHECK_ACCESS(_res_conv_25_ptr);
19601 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
19602 FREE((void*)_res_conv_25);
19603 _res_constr.data[z] = _res_conv_25_conv;
19605 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19606 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
19609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
19610 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19611 *ret_conv = CResult_boolLightningErrorZ_ok(o);
19612 return (uintptr_t)ret_conv;
19615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19616 LDKLightningError e_conv;
19617 e_conv.inner = (void*)(e & (~1));
19618 e_conv.is_owned = (e & 1) || (e == 0);
19619 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19620 e_conv = LightningError_clone(&e_conv);
19621 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19622 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
19623 return (uintptr_t)ret_conv;
19626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19627 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
19628 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
19632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19633 if ((_res & 1) != 0) return;
19634 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19635 CHECK_ACCESS(_res_ptr);
19636 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
19638 CResult_boolLightningErrorZ_free(_res_conv);
19641 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
19642 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19643 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
19644 return (uintptr_t)ret_conv;
19646 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19647 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
19648 intptr_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
19652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19653 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
19654 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19655 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
19656 return (uintptr_t)ret_conv;
19659 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
19660 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19661 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
19662 return ((uintptr_t)ret_conv);
19664 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19665 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
19666 intptr_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
19670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19671 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
19672 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19673 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
19674 return ((uintptr_t)ret_conv);
19677 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) {
19678 LDKChannelAnnouncement a_conv;
19679 a_conv.inner = (void*)(a & (~1));
19680 a_conv.is_owned = (a & 1) || (a == 0);
19681 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19682 a_conv = ChannelAnnouncement_clone(&a_conv);
19683 LDKChannelUpdate b_conv;
19684 b_conv.inner = (void*)(b & (~1));
19685 b_conv.is_owned = (b & 1) || (b == 0);
19686 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19687 b_conv = ChannelUpdate_clone(&b_conv);
19688 LDKChannelUpdate c_conv;
19689 c_conv.inner = (void*)(c & (~1));
19690 c_conv.is_owned = (c & 1) || (c == 0);
19691 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19692 c_conv = ChannelUpdate_clone(&c_conv);
19693 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19694 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
19695 return ((uintptr_t)ret_conv);
19698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19699 if ((_res & 1) != 0) return;
19700 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19701 CHECK_ACCESS(_res_ptr);
19702 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
19704 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
19707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19708 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
19709 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19710 if (_res_constr.datalen > 0)
19711 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
19713 _res_constr.data = NULL;
19714 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19715 for (size_t h = 0; h < _res_constr.datalen; h++) {
19716 int64_t _res_conv_59 = _res_vals[h];
19717 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
19718 CHECK_ACCESS(_res_conv_59_ptr);
19719 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
19720 FREE((void*)_res_conv_59);
19721 _res_constr.data[h] = _res_conv_59_conv;
19723 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19724 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
19727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19728 LDKCVec_NodeAnnouncementZ _res_constr;
19729 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19730 if (_res_constr.datalen > 0)
19731 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
19733 _res_constr.data = NULL;
19734 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19735 for (size_t s = 0; s < _res_constr.datalen; s++) {
19736 int64_t _res_conv_18 = _res_vals[s];
19737 LDKNodeAnnouncement _res_conv_18_conv;
19738 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
19739 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
19740 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
19741 _res_constr.data[s] = _res_conv_18_conv;
19743 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19744 CVec_NodeAnnouncementZ_free(_res_constr);
19747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19748 LDKCVec_PublicKeyZ _res_constr;
19749 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19750 if (_res_constr.datalen > 0)
19751 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
19753 _res_constr.data = NULL;
19754 for (size_t i = 0; i < _res_constr.datalen; i++) {
19755 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19756 LDKPublicKey _res_conv_8_ref;
19757 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
19758 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
19759 _res_constr.data[i] = _res_conv_8_ref;
19761 CVec_PublicKeyZ_free(_res_constr);
19764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19766 o_ref.datalen = (*env)->GetArrayLength(env, o);
19767 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
19768 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
19769 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19770 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
19771 return (uintptr_t)ret_conv;
19774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19775 LDKPeerHandleError e_conv;
19776 e_conv.inner = (void*)(e & (~1));
19777 e_conv.is_owned = (e & 1) || (e == 0);
19778 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19779 e_conv = PeerHandleError_clone(&e_conv);
19780 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19781 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
19782 return (uintptr_t)ret_conv;
19785 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19786 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
19787 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
19791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19792 if ((_res & 1) != 0) return;
19793 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19794 CHECK_ACCESS(_res_ptr);
19795 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
19797 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
19800 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
19801 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19802 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
19803 return (uintptr_t)ret_conv;
19805 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19806 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
19807 intptr_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
19811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19812 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
19813 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19814 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
19815 return (uintptr_t)ret_conv;
19818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
19819 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19820 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
19821 return (uintptr_t)ret_conv;
19824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19825 LDKPeerHandleError e_conv;
19826 e_conv.inner = (void*)(e & (~1));
19827 e_conv.is_owned = (e & 1) || (e == 0);
19828 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19829 e_conv = PeerHandleError_clone(&e_conv);
19830 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19831 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
19832 return (uintptr_t)ret_conv;
19835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19836 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
19837 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
19841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19842 if ((_res & 1) != 0) return;
19843 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19844 CHECK_ACCESS(_res_ptr);
19845 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
19847 CResult_NonePeerHandleErrorZ_free(_res_conv);
19850 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
19851 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19852 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
19853 return (uintptr_t)ret_conv;
19855 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19856 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
19857 intptr_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
19861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19862 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
19863 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19864 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
19865 return (uintptr_t)ret_conv;
19868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
19869 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19870 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
19871 return (uintptr_t)ret_conv;
19874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19875 LDKPeerHandleError e_conv;
19876 e_conv.inner = (void*)(e & (~1));
19877 e_conv.is_owned = (e & 1) || (e == 0);
19878 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19879 e_conv = PeerHandleError_clone(&e_conv);
19880 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19881 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
19882 return (uintptr_t)ret_conv;
19885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19886 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
19887 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
19891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19892 if ((_res & 1) != 0) return;
19893 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19894 CHECK_ACCESS(_res_ptr);
19895 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
19897 CResult_boolPeerHandleErrorZ_free(_res_conv);
19900 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
19901 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19902 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
19903 return (uintptr_t)ret_conv;
19905 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19906 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
19907 intptr_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
19911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19912 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
19913 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19914 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
19915 return (uintptr_t)ret_conv;
19918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19920 o_conv.inner = (void*)(o & (~1));
19921 o_conv.is_owned = (o & 1) || (o == 0);
19922 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19923 o_conv = NodeId_clone(&o_conv);
19924 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19925 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
19926 return (uintptr_t)ret_conv;
19929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19930 LDKDecodeError e_conv;
19931 e_conv.inner = (void*)(e & (~1));
19932 e_conv.is_owned = (e & 1) || (e == 0);
19933 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19934 e_conv = DecodeError_clone(&e_conv);
19935 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19936 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
19937 return (uintptr_t)ret_conv;
19940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19941 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
19942 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
19946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19947 if ((_res & 1) != 0) return;
19948 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19949 CHECK_ACCESS(_res_ptr);
19950 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
19952 CResult_NodeIdDecodeErrorZ_free(_res_conv);
19955 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
19956 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19957 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
19958 return (uintptr_t)ret_conv;
19960 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19961 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
19962 intptr_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
19966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19967 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
19968 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19969 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
19970 return (uintptr_t)ret_conv;
19973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19974 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19975 CHECK_ACCESS(o_ptr);
19976 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
19977 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
19978 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19979 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
19980 return (uintptr_t)ret_conv;
19983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19984 LDKDecodeError e_conv;
19985 e_conv.inner = (void*)(e & (~1));
19986 e_conv.is_owned = (e & 1) || (e == 0);
19987 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19988 e_conv = DecodeError_clone(&e_conv);
19989 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19990 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
19991 return (uintptr_t)ret_conv;
19994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19995 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
19996 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
20000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20001 if ((_res & 1) != 0) return;
20002 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20003 CHECK_ACCESS(_res_ptr);
20004 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
20006 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
20009 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
20010 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20011 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
20012 return (uintptr_t)ret_conv;
20014 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20015 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
20016 intptr_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
20020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20021 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
20022 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20023 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
20024 return (uintptr_t)ret_conv;
20027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20028 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20029 CHECK_ACCESS(o_ptr);
20030 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
20031 if (o_conv.free == LDKAccess_JCalls_free) {
20032 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20033 LDKAccess_JCalls_cloned(&o_conv);
20035 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
20036 *ret_copy = COption_AccessZ_some(o_conv);
20037 uintptr_t ret_ref = (uintptr_t)ret_copy;
20041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
20042 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
20043 *ret_copy = COption_AccessZ_none();
20044 uintptr_t ret_ref = (uintptr_t)ret_copy;
20048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20049 if ((_res & 1) != 0) return;
20050 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20051 CHECK_ACCESS(_res_ptr);
20052 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
20054 COption_AccessZ_free(_res_conv);
20057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20058 LDKChannelUpdateInfo o_conv;
20059 o_conv.inner = (void*)(o & (~1));
20060 o_conv.is_owned = (o & 1) || (o == 0);
20061 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20062 o_conv = ChannelUpdateInfo_clone(&o_conv);
20063 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20064 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
20065 return (uintptr_t)ret_conv;
20068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20069 LDKDecodeError e_conv;
20070 e_conv.inner = (void*)(e & (~1));
20071 e_conv.is_owned = (e & 1) || (e == 0);
20072 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20073 e_conv = DecodeError_clone(&e_conv);
20074 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20075 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
20076 return (uintptr_t)ret_conv;
20079 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20080 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
20081 jboolean ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
20085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20086 if ((_res & 1) != 0) return;
20087 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20088 CHECK_ACCESS(_res_ptr);
20089 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
20091 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
20094 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
20095 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20096 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
20097 return (uintptr_t)ret_conv;
20099 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20100 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
20101 intptr_t ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
20105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20106 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
20107 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20108 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
20109 return (uintptr_t)ret_conv;
20112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20113 LDKChannelInfo o_conv;
20114 o_conv.inner = (void*)(o & (~1));
20115 o_conv.is_owned = (o & 1) || (o == 0);
20116 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20117 o_conv = ChannelInfo_clone(&o_conv);
20118 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20119 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
20120 return (uintptr_t)ret_conv;
20123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20124 LDKDecodeError e_conv;
20125 e_conv.inner = (void*)(e & (~1));
20126 e_conv.is_owned = (e & 1) || (e == 0);
20127 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20128 e_conv = DecodeError_clone(&e_conv);
20129 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20130 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
20131 return (uintptr_t)ret_conv;
20134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20135 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
20136 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
20140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20141 if ((_res & 1) != 0) return;
20142 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20143 CHECK_ACCESS(_res_ptr);
20144 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
20146 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
20149 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
20150 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20151 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
20152 return (uintptr_t)ret_conv;
20154 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20155 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
20156 intptr_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
20160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20161 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
20162 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20163 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
20164 return (uintptr_t)ret_conv;
20167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20168 LDKRoutingFees o_conv;
20169 o_conv.inner = (void*)(o & (~1));
20170 o_conv.is_owned = (o & 1) || (o == 0);
20171 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20172 o_conv = RoutingFees_clone(&o_conv);
20173 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20174 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
20175 return (uintptr_t)ret_conv;
20178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20179 LDKDecodeError e_conv;
20180 e_conv.inner = (void*)(e & (~1));
20181 e_conv.is_owned = (e & 1) || (e == 0);
20182 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20183 e_conv = DecodeError_clone(&e_conv);
20184 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20185 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
20186 return (uintptr_t)ret_conv;
20189 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20190 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
20191 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
20195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20196 if ((_res & 1) != 0) return;
20197 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20198 CHECK_ACCESS(_res_ptr);
20199 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
20201 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
20204 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
20205 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20206 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
20207 return (uintptr_t)ret_conv;
20209 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20210 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
20211 intptr_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
20215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20216 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
20217 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20218 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
20219 return (uintptr_t)ret_conv;
20222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20223 LDKNodeAnnouncementInfo o_conv;
20224 o_conv.inner = (void*)(o & (~1));
20225 o_conv.is_owned = (o & 1) || (o == 0);
20226 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20227 o_conv = NodeAnnouncementInfo_clone(&o_conv);
20228 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20229 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
20230 return (uintptr_t)ret_conv;
20233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20234 LDKDecodeError e_conv;
20235 e_conv.inner = (void*)(e & (~1));
20236 e_conv.is_owned = (e & 1) || (e == 0);
20237 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20238 e_conv = DecodeError_clone(&e_conv);
20239 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20240 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
20241 return (uintptr_t)ret_conv;
20244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20245 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
20246 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
20250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20251 if ((_res & 1) != 0) return;
20252 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20253 CHECK_ACCESS(_res_ptr);
20254 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
20256 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
20259 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
20260 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20261 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
20262 return (uintptr_t)ret_conv;
20264 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20265 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
20266 intptr_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
20270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20271 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
20272 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20273 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
20274 return (uintptr_t)ret_conv;
20277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20278 LDKCVec_u64Z _res_constr;
20279 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20280 if (_res_constr.datalen > 0)
20281 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20283 _res_constr.data = NULL;
20284 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20285 for (size_t g = 0; g < _res_constr.datalen; g++) {
20286 int64_t _res_conv_6 = _res_vals[g];
20287 _res_constr.data[g] = _res_conv_6;
20289 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20290 CVec_u64Z_free(_res_constr);
20293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20294 LDKNodeInfo o_conv;
20295 o_conv.inner = (void*)(o & (~1));
20296 o_conv.is_owned = (o & 1) || (o == 0);
20297 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20298 o_conv = NodeInfo_clone(&o_conv);
20299 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20300 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
20301 return (uintptr_t)ret_conv;
20304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20305 LDKDecodeError e_conv;
20306 e_conv.inner = (void*)(e & (~1));
20307 e_conv.is_owned = (e & 1) || (e == 0);
20308 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20309 e_conv = DecodeError_clone(&e_conv);
20310 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20311 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
20312 return (uintptr_t)ret_conv;
20315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20316 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
20317 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
20321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20322 if ((_res & 1) != 0) return;
20323 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20324 CHECK_ACCESS(_res_ptr);
20325 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
20327 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
20330 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
20331 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20332 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
20333 return (uintptr_t)ret_conv;
20335 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20336 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
20337 intptr_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
20341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20342 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
20343 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20344 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
20345 return (uintptr_t)ret_conv;
20348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20349 LDKNetworkGraph o_conv;
20350 o_conv.inner = (void*)(o & (~1));
20351 o_conv.is_owned = (o & 1) || (o == 0);
20352 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20353 o_conv = NetworkGraph_clone(&o_conv);
20354 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20355 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
20356 return (uintptr_t)ret_conv;
20359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20360 LDKDecodeError e_conv;
20361 e_conv.inner = (void*)(e & (~1));
20362 e_conv.is_owned = (e & 1) || (e == 0);
20363 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20364 e_conv = DecodeError_clone(&e_conv);
20365 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20366 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
20367 return (uintptr_t)ret_conv;
20370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20371 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
20372 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
20376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20377 if ((_res & 1) != 0) return;
20378 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20379 CHECK_ACCESS(_res_ptr);
20380 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
20382 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
20385 static inline uintptr_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
20386 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20387 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
20388 return (uintptr_t)ret_conv;
20390 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20391 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
20392 intptr_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
20396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20397 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
20398 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20399 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
20400 return (uintptr_t)ret_conv;
20403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
20404 LDKCVec_NetAddressZ o_constr;
20405 o_constr.datalen = (*env)->GetArrayLength(env, o);
20406 if (o_constr.datalen > 0)
20407 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20409 o_constr.data = NULL;
20410 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
20411 for (size_t m = 0; m < o_constr.datalen; m++) {
20412 int64_t o_conv_12 = o_vals[m];
20413 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
20414 CHECK_ACCESS(o_conv_12_ptr);
20415 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
20416 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
20417 o_constr.data[m] = o_conv_12_conv;
20419 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
20420 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20421 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
20422 uintptr_t ret_ref = (uintptr_t)ret_copy;
20426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
20427 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20428 *ret_copy = COption_CVec_NetAddressZZ_none();
20429 uintptr_t ret_ref = (uintptr_t)ret_copy;
20433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20434 if ((_res & 1) != 0) return;
20435 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20436 CHECK_ACCESS(_res_ptr);
20437 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
20439 COption_CVec_NetAddressZZ_free(_res_conv);
20442 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
20443 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20444 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
20445 uintptr_t ret_ref = (uintptr_t)ret_copy;
20448 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20449 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
20450 intptr_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
20454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20455 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
20456 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20457 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
20458 uintptr_t ret_ref = (uintptr_t)ret_copy;
20462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20463 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20464 CHECK_ACCESS(o_ptr);
20465 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
20466 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
20467 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20468 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
20469 return (uintptr_t)ret_conv;
20472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20473 LDKDecodeError e_conv;
20474 e_conv.inner = (void*)(e & (~1));
20475 e_conv.is_owned = (e & 1) || (e == 0);
20476 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20477 e_conv = DecodeError_clone(&e_conv);
20478 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20479 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
20480 return (uintptr_t)ret_conv;
20483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20484 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
20485 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
20489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20490 if ((_res & 1) != 0) return;
20491 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20492 CHECK_ACCESS(_res_ptr);
20493 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
20495 CResult_NetAddressDecodeErrorZ_free(_res_conv);
20498 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
20499 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20500 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
20501 return (uintptr_t)ret_conv;
20503 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20504 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
20505 intptr_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
20509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20510 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
20511 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20512 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
20513 return (uintptr_t)ret_conv;
20516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20517 LDKCVec_UpdateAddHTLCZ _res_constr;
20518 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20519 if (_res_constr.datalen > 0)
20520 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20522 _res_constr.data = NULL;
20523 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20524 for (size_t p = 0; p < _res_constr.datalen; p++) {
20525 int64_t _res_conv_15 = _res_vals[p];
20526 LDKUpdateAddHTLC _res_conv_15_conv;
20527 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
20528 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
20529 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
20530 _res_constr.data[p] = _res_conv_15_conv;
20532 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20533 CVec_UpdateAddHTLCZ_free(_res_constr);
20536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20537 LDKCVec_UpdateFulfillHTLCZ _res_constr;
20538 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20539 if (_res_constr.datalen > 0)
20540 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20542 _res_constr.data = NULL;
20543 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20544 for (size_t t = 0; t < _res_constr.datalen; t++) {
20545 int64_t _res_conv_19 = _res_vals[t];
20546 LDKUpdateFulfillHTLC _res_conv_19_conv;
20547 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
20548 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
20549 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
20550 _res_constr.data[t] = _res_conv_19_conv;
20552 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20553 CVec_UpdateFulfillHTLCZ_free(_res_constr);
20556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20557 LDKCVec_UpdateFailHTLCZ _res_constr;
20558 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20559 if (_res_constr.datalen > 0)
20560 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20562 _res_constr.data = NULL;
20563 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20564 for (size_t q = 0; q < _res_constr.datalen; q++) {
20565 int64_t _res_conv_16 = _res_vals[q];
20566 LDKUpdateFailHTLC _res_conv_16_conv;
20567 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
20568 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
20569 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20570 _res_constr.data[q] = _res_conv_16_conv;
20572 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20573 CVec_UpdateFailHTLCZ_free(_res_constr);
20576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20577 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
20578 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20579 if (_res_constr.datalen > 0)
20580 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20582 _res_constr.data = NULL;
20583 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20584 for (size_t z = 0; z < _res_constr.datalen; z++) {
20585 int64_t _res_conv_25 = _res_vals[z];
20586 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
20587 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
20588 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
20589 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
20590 _res_constr.data[z] = _res_conv_25_conv;
20592 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20593 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
20596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20597 LDKAcceptChannel o_conv;
20598 o_conv.inner = (void*)(o & (~1));
20599 o_conv.is_owned = (o & 1) || (o == 0);
20600 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20601 o_conv = AcceptChannel_clone(&o_conv);
20602 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20603 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
20604 return (uintptr_t)ret_conv;
20607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20608 LDKDecodeError e_conv;
20609 e_conv.inner = (void*)(e & (~1));
20610 e_conv.is_owned = (e & 1) || (e == 0);
20611 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20612 e_conv = DecodeError_clone(&e_conv);
20613 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20614 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
20615 return (uintptr_t)ret_conv;
20618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20619 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
20620 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
20624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20625 if ((_res & 1) != 0) return;
20626 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20627 CHECK_ACCESS(_res_ptr);
20628 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
20630 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
20633 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
20634 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20635 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
20636 return (uintptr_t)ret_conv;
20638 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20639 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
20640 intptr_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
20644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20645 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
20646 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20647 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
20648 return (uintptr_t)ret_conv;
20651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20652 LDKAnnouncementSignatures o_conv;
20653 o_conv.inner = (void*)(o & (~1));
20654 o_conv.is_owned = (o & 1) || (o == 0);
20655 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20656 o_conv = AnnouncementSignatures_clone(&o_conv);
20657 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20658 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
20659 return (uintptr_t)ret_conv;
20662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20663 LDKDecodeError e_conv;
20664 e_conv.inner = (void*)(e & (~1));
20665 e_conv.is_owned = (e & 1) || (e == 0);
20666 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20667 e_conv = DecodeError_clone(&e_conv);
20668 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20669 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
20670 return (uintptr_t)ret_conv;
20673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20674 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
20675 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
20679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20680 if ((_res & 1) != 0) return;
20681 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20682 CHECK_ACCESS(_res_ptr);
20683 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
20685 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
20688 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
20689 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20690 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
20691 return (uintptr_t)ret_conv;
20693 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20694 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
20695 intptr_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
20699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20700 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
20701 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20702 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
20703 return (uintptr_t)ret_conv;
20706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20707 LDKChannelReestablish o_conv;
20708 o_conv.inner = (void*)(o & (~1));
20709 o_conv.is_owned = (o & 1) || (o == 0);
20710 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20711 o_conv = ChannelReestablish_clone(&o_conv);
20712 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20713 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
20714 return (uintptr_t)ret_conv;
20717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20718 LDKDecodeError e_conv;
20719 e_conv.inner = (void*)(e & (~1));
20720 e_conv.is_owned = (e & 1) || (e == 0);
20721 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20722 e_conv = DecodeError_clone(&e_conv);
20723 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20724 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
20725 return (uintptr_t)ret_conv;
20728 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20729 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
20730 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
20734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20735 if ((_res & 1) != 0) return;
20736 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20737 CHECK_ACCESS(_res_ptr);
20738 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
20740 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
20743 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
20744 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20745 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
20746 return (uintptr_t)ret_conv;
20748 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20749 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
20750 intptr_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
20754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20755 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
20756 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20757 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
20758 return (uintptr_t)ret_conv;
20761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20762 LDKClosingSigned o_conv;
20763 o_conv.inner = (void*)(o & (~1));
20764 o_conv.is_owned = (o & 1) || (o == 0);
20765 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20766 o_conv = ClosingSigned_clone(&o_conv);
20767 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20768 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
20769 return (uintptr_t)ret_conv;
20772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20773 LDKDecodeError e_conv;
20774 e_conv.inner = (void*)(e & (~1));
20775 e_conv.is_owned = (e & 1) || (e == 0);
20776 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20777 e_conv = DecodeError_clone(&e_conv);
20778 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20779 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
20780 return (uintptr_t)ret_conv;
20783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20784 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
20785 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
20789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20790 if ((_res & 1) != 0) return;
20791 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20792 CHECK_ACCESS(_res_ptr);
20793 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
20795 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
20798 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
20799 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20800 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
20801 return (uintptr_t)ret_conv;
20803 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20804 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
20805 intptr_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
20809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20810 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
20811 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20812 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
20813 return (uintptr_t)ret_conv;
20816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20817 LDKClosingSignedFeeRange o_conv;
20818 o_conv.inner = (void*)(o & (~1));
20819 o_conv.is_owned = (o & 1) || (o == 0);
20820 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20821 o_conv = ClosingSignedFeeRange_clone(&o_conv);
20822 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20823 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
20824 return (uintptr_t)ret_conv;
20827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20828 LDKDecodeError e_conv;
20829 e_conv.inner = (void*)(e & (~1));
20830 e_conv.is_owned = (e & 1) || (e == 0);
20831 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20832 e_conv = DecodeError_clone(&e_conv);
20833 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20834 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
20835 return (uintptr_t)ret_conv;
20838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20839 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
20840 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
20844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20845 if ((_res & 1) != 0) return;
20846 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20847 CHECK_ACCESS(_res_ptr);
20848 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
20850 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
20853 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
20854 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20855 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
20856 return (uintptr_t)ret_conv;
20858 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20859 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
20860 intptr_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
20864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20865 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
20866 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20867 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
20868 return (uintptr_t)ret_conv;
20871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20872 LDKCommitmentSigned o_conv;
20873 o_conv.inner = (void*)(o & (~1));
20874 o_conv.is_owned = (o & 1) || (o == 0);
20875 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20876 o_conv = CommitmentSigned_clone(&o_conv);
20877 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20878 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
20879 return (uintptr_t)ret_conv;
20882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20883 LDKDecodeError e_conv;
20884 e_conv.inner = (void*)(e & (~1));
20885 e_conv.is_owned = (e & 1) || (e == 0);
20886 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20887 e_conv = DecodeError_clone(&e_conv);
20888 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20889 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
20890 return (uintptr_t)ret_conv;
20893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20894 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
20895 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
20899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20900 if ((_res & 1) != 0) return;
20901 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20902 CHECK_ACCESS(_res_ptr);
20903 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
20905 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
20908 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
20909 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20910 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
20911 return (uintptr_t)ret_conv;
20913 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20914 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
20915 intptr_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
20919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20920 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
20921 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20922 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
20923 return (uintptr_t)ret_conv;
20926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20927 LDKFundingCreated o_conv;
20928 o_conv.inner = (void*)(o & (~1));
20929 o_conv.is_owned = (o & 1) || (o == 0);
20930 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20931 o_conv = FundingCreated_clone(&o_conv);
20932 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20933 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
20934 return (uintptr_t)ret_conv;
20937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20938 LDKDecodeError e_conv;
20939 e_conv.inner = (void*)(e & (~1));
20940 e_conv.is_owned = (e & 1) || (e == 0);
20941 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20942 e_conv = DecodeError_clone(&e_conv);
20943 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20944 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
20945 return (uintptr_t)ret_conv;
20948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20949 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
20950 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
20954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20955 if ((_res & 1) != 0) return;
20956 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20957 CHECK_ACCESS(_res_ptr);
20958 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
20960 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
20963 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
20964 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20965 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
20966 return (uintptr_t)ret_conv;
20968 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20969 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
20970 intptr_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
20974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20975 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
20976 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20977 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
20978 return (uintptr_t)ret_conv;
20981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20982 LDKFundingSigned o_conv;
20983 o_conv.inner = (void*)(o & (~1));
20984 o_conv.is_owned = (o & 1) || (o == 0);
20985 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20986 o_conv = FundingSigned_clone(&o_conv);
20987 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20988 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
20989 return (uintptr_t)ret_conv;
20992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20993 LDKDecodeError e_conv;
20994 e_conv.inner = (void*)(e & (~1));
20995 e_conv.is_owned = (e & 1) || (e == 0);
20996 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20997 e_conv = DecodeError_clone(&e_conv);
20998 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20999 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
21000 return (uintptr_t)ret_conv;
21003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21004 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
21005 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
21009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21010 if ((_res & 1) != 0) return;
21011 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21012 CHECK_ACCESS(_res_ptr);
21013 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
21015 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
21018 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
21019 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21020 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
21021 return (uintptr_t)ret_conv;
21023 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21024 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
21025 intptr_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
21029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21030 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
21031 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21032 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
21033 return (uintptr_t)ret_conv;
21036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21037 LDKFundingLocked o_conv;
21038 o_conv.inner = (void*)(o & (~1));
21039 o_conv.is_owned = (o & 1) || (o == 0);
21040 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21041 o_conv = FundingLocked_clone(&o_conv);
21042 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21043 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
21044 return (uintptr_t)ret_conv;
21047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21048 LDKDecodeError e_conv;
21049 e_conv.inner = (void*)(e & (~1));
21050 e_conv.is_owned = (e & 1) || (e == 0);
21051 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21052 e_conv = DecodeError_clone(&e_conv);
21053 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21054 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
21055 return (uintptr_t)ret_conv;
21058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21059 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
21060 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
21064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21065 if ((_res & 1) != 0) return;
21066 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21067 CHECK_ACCESS(_res_ptr);
21068 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
21070 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
21073 static inline uintptr_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
21074 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21075 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
21076 return (uintptr_t)ret_conv;
21078 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21079 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
21080 intptr_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
21084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21085 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
21086 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21087 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
21088 return (uintptr_t)ret_conv;
21091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21093 o_conv.inner = (void*)(o & (~1));
21094 o_conv.is_owned = (o & 1) || (o == 0);
21095 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21096 o_conv = Init_clone(&o_conv);
21097 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21098 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
21099 return (uintptr_t)ret_conv;
21102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21103 LDKDecodeError e_conv;
21104 e_conv.inner = (void*)(e & (~1));
21105 e_conv.is_owned = (e & 1) || (e == 0);
21106 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21107 e_conv = DecodeError_clone(&e_conv);
21108 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21109 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
21110 return (uintptr_t)ret_conv;
21113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21114 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
21115 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
21119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21120 if ((_res & 1) != 0) return;
21121 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21122 CHECK_ACCESS(_res_ptr);
21123 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
21125 CResult_InitDecodeErrorZ_free(_res_conv);
21128 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
21129 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21130 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
21131 return (uintptr_t)ret_conv;
21133 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21134 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
21135 intptr_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
21139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21140 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
21141 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21142 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
21143 return (uintptr_t)ret_conv;
21146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21147 LDKOpenChannel o_conv;
21148 o_conv.inner = (void*)(o & (~1));
21149 o_conv.is_owned = (o & 1) || (o == 0);
21150 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21151 o_conv = OpenChannel_clone(&o_conv);
21152 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21153 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
21154 return (uintptr_t)ret_conv;
21157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21158 LDKDecodeError e_conv;
21159 e_conv.inner = (void*)(e & (~1));
21160 e_conv.is_owned = (e & 1) || (e == 0);
21161 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21162 e_conv = DecodeError_clone(&e_conv);
21163 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21164 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
21165 return (uintptr_t)ret_conv;
21168 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21169 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
21170 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
21174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21175 if ((_res & 1) != 0) return;
21176 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21177 CHECK_ACCESS(_res_ptr);
21178 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
21180 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
21183 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
21184 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21185 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
21186 return (uintptr_t)ret_conv;
21188 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21189 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
21190 intptr_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
21194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21195 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
21196 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21197 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
21198 return (uintptr_t)ret_conv;
21201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21202 LDKRevokeAndACK o_conv;
21203 o_conv.inner = (void*)(o & (~1));
21204 o_conv.is_owned = (o & 1) || (o == 0);
21205 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21206 o_conv = RevokeAndACK_clone(&o_conv);
21207 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21208 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
21209 return (uintptr_t)ret_conv;
21212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21213 LDKDecodeError e_conv;
21214 e_conv.inner = (void*)(e & (~1));
21215 e_conv.is_owned = (e & 1) || (e == 0);
21216 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21217 e_conv = DecodeError_clone(&e_conv);
21218 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21219 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
21220 return (uintptr_t)ret_conv;
21223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21224 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
21225 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
21229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21230 if ((_res & 1) != 0) return;
21231 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21232 CHECK_ACCESS(_res_ptr);
21233 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
21235 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
21238 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
21239 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21240 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
21241 return (uintptr_t)ret_conv;
21243 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21244 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
21245 intptr_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
21249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21250 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
21251 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21252 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
21253 return (uintptr_t)ret_conv;
21256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21257 LDKShutdown o_conv;
21258 o_conv.inner = (void*)(o & (~1));
21259 o_conv.is_owned = (o & 1) || (o == 0);
21260 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21261 o_conv = Shutdown_clone(&o_conv);
21262 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21263 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
21264 return (uintptr_t)ret_conv;
21267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21268 LDKDecodeError e_conv;
21269 e_conv.inner = (void*)(e & (~1));
21270 e_conv.is_owned = (e & 1) || (e == 0);
21271 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21272 e_conv = DecodeError_clone(&e_conv);
21273 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21274 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
21275 return (uintptr_t)ret_conv;
21278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21279 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
21280 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
21284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21285 if ((_res & 1) != 0) return;
21286 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21287 CHECK_ACCESS(_res_ptr);
21288 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
21290 CResult_ShutdownDecodeErrorZ_free(_res_conv);
21293 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
21294 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21295 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
21296 return (uintptr_t)ret_conv;
21298 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21299 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
21300 intptr_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
21304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21305 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
21306 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21307 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
21308 return (uintptr_t)ret_conv;
21311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21312 LDKUpdateFailHTLC o_conv;
21313 o_conv.inner = (void*)(o & (~1));
21314 o_conv.is_owned = (o & 1) || (o == 0);
21315 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21316 o_conv = UpdateFailHTLC_clone(&o_conv);
21317 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21318 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
21319 return (uintptr_t)ret_conv;
21322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21323 LDKDecodeError e_conv;
21324 e_conv.inner = (void*)(e & (~1));
21325 e_conv.is_owned = (e & 1) || (e == 0);
21326 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21327 e_conv = DecodeError_clone(&e_conv);
21328 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21329 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
21330 return (uintptr_t)ret_conv;
21333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21334 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
21335 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
21339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21340 if ((_res & 1) != 0) return;
21341 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21342 CHECK_ACCESS(_res_ptr);
21343 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
21345 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
21348 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
21349 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21350 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
21351 return (uintptr_t)ret_conv;
21353 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21354 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
21355 intptr_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
21359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21360 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
21361 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21362 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
21363 return (uintptr_t)ret_conv;
21366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21367 LDKUpdateFailMalformedHTLC o_conv;
21368 o_conv.inner = (void*)(o & (~1));
21369 o_conv.is_owned = (o & 1) || (o == 0);
21370 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21371 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
21372 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21373 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
21374 return (uintptr_t)ret_conv;
21377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21378 LDKDecodeError e_conv;
21379 e_conv.inner = (void*)(e & (~1));
21380 e_conv.is_owned = (e & 1) || (e == 0);
21381 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21382 e_conv = DecodeError_clone(&e_conv);
21383 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21384 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
21385 return (uintptr_t)ret_conv;
21388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21389 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
21390 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
21394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21395 if ((_res & 1) != 0) return;
21396 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21397 CHECK_ACCESS(_res_ptr);
21398 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
21400 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
21403 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
21404 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21405 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
21406 return (uintptr_t)ret_conv;
21408 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21409 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
21410 intptr_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
21414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21415 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
21416 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21417 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
21418 return (uintptr_t)ret_conv;
21421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21422 LDKUpdateFee o_conv;
21423 o_conv.inner = (void*)(o & (~1));
21424 o_conv.is_owned = (o & 1) || (o == 0);
21425 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21426 o_conv = UpdateFee_clone(&o_conv);
21427 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21428 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
21429 return (uintptr_t)ret_conv;
21432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21433 LDKDecodeError e_conv;
21434 e_conv.inner = (void*)(e & (~1));
21435 e_conv.is_owned = (e & 1) || (e == 0);
21436 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21437 e_conv = DecodeError_clone(&e_conv);
21438 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21439 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
21440 return (uintptr_t)ret_conv;
21443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21444 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
21445 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
21449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21450 if ((_res & 1) != 0) return;
21451 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21452 CHECK_ACCESS(_res_ptr);
21453 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
21455 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
21458 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
21459 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21460 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
21461 return (uintptr_t)ret_conv;
21463 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21464 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
21465 intptr_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
21469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21470 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
21471 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21472 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
21473 return (uintptr_t)ret_conv;
21476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21477 LDKUpdateFulfillHTLC o_conv;
21478 o_conv.inner = (void*)(o & (~1));
21479 o_conv.is_owned = (o & 1) || (o == 0);
21480 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21481 o_conv = UpdateFulfillHTLC_clone(&o_conv);
21482 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21483 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
21484 return (uintptr_t)ret_conv;
21487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21488 LDKDecodeError e_conv;
21489 e_conv.inner = (void*)(e & (~1));
21490 e_conv.is_owned = (e & 1) || (e == 0);
21491 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21492 e_conv = DecodeError_clone(&e_conv);
21493 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21494 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
21495 return (uintptr_t)ret_conv;
21498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21499 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
21500 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
21504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21505 if ((_res & 1) != 0) return;
21506 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21507 CHECK_ACCESS(_res_ptr);
21508 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
21510 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
21513 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
21514 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21515 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
21516 return (uintptr_t)ret_conv;
21518 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21519 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
21520 intptr_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
21524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21525 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
21526 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21527 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
21528 return (uintptr_t)ret_conv;
21531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21532 LDKUpdateAddHTLC o_conv;
21533 o_conv.inner = (void*)(o & (~1));
21534 o_conv.is_owned = (o & 1) || (o == 0);
21535 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21536 o_conv = UpdateAddHTLC_clone(&o_conv);
21537 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21538 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
21539 return (uintptr_t)ret_conv;
21542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21543 LDKDecodeError e_conv;
21544 e_conv.inner = (void*)(e & (~1));
21545 e_conv.is_owned = (e & 1) || (e == 0);
21546 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21547 e_conv = DecodeError_clone(&e_conv);
21548 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21549 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
21550 return (uintptr_t)ret_conv;
21553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21554 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
21555 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
21559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21560 if ((_res & 1) != 0) return;
21561 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21562 CHECK_ACCESS(_res_ptr);
21563 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
21565 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
21568 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
21569 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21570 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
21571 return (uintptr_t)ret_conv;
21573 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21574 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
21575 intptr_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
21579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21580 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
21581 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21582 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
21583 return (uintptr_t)ret_conv;
21586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21588 o_conv.inner = (void*)(o & (~1));
21589 o_conv.is_owned = (o & 1) || (o == 0);
21590 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21591 o_conv = Ping_clone(&o_conv);
21592 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21593 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
21594 return (uintptr_t)ret_conv;
21597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21598 LDKDecodeError e_conv;
21599 e_conv.inner = (void*)(e & (~1));
21600 e_conv.is_owned = (e & 1) || (e == 0);
21601 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21602 e_conv = DecodeError_clone(&e_conv);
21603 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21604 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
21605 return (uintptr_t)ret_conv;
21608 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21609 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
21610 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
21614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21615 if ((_res & 1) != 0) return;
21616 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21617 CHECK_ACCESS(_res_ptr);
21618 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
21620 CResult_PingDecodeErrorZ_free(_res_conv);
21623 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
21624 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21625 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
21626 return (uintptr_t)ret_conv;
21628 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21629 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
21630 intptr_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
21634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21635 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
21636 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21637 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
21638 return (uintptr_t)ret_conv;
21641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21643 o_conv.inner = (void*)(o & (~1));
21644 o_conv.is_owned = (o & 1) || (o == 0);
21645 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21646 o_conv = Pong_clone(&o_conv);
21647 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21648 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
21649 return (uintptr_t)ret_conv;
21652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21653 LDKDecodeError e_conv;
21654 e_conv.inner = (void*)(e & (~1));
21655 e_conv.is_owned = (e & 1) || (e == 0);
21656 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21657 e_conv = DecodeError_clone(&e_conv);
21658 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21659 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
21660 return (uintptr_t)ret_conv;
21663 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21664 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
21665 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
21669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21670 if ((_res & 1) != 0) return;
21671 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21672 CHECK_ACCESS(_res_ptr);
21673 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
21675 CResult_PongDecodeErrorZ_free(_res_conv);
21678 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
21679 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21680 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
21681 return (uintptr_t)ret_conv;
21683 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21684 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
21685 intptr_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
21689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21690 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
21691 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21692 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
21693 return (uintptr_t)ret_conv;
21696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21697 LDKUnsignedChannelAnnouncement o_conv;
21698 o_conv.inner = (void*)(o & (~1));
21699 o_conv.is_owned = (o & 1) || (o == 0);
21700 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21701 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
21702 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21703 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
21704 return (uintptr_t)ret_conv;
21707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21708 LDKDecodeError e_conv;
21709 e_conv.inner = (void*)(e & (~1));
21710 e_conv.is_owned = (e & 1) || (e == 0);
21711 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21712 e_conv = DecodeError_clone(&e_conv);
21713 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21714 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
21715 return (uintptr_t)ret_conv;
21718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21719 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
21720 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21725 if ((_res & 1) != 0) return;
21726 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21727 CHECK_ACCESS(_res_ptr);
21728 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21730 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
21733 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21734 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21735 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
21736 return (uintptr_t)ret_conv;
21738 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21739 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
21740 intptr_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21745 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
21746 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21747 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21748 return (uintptr_t)ret_conv;
21751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21752 LDKChannelAnnouncement o_conv;
21753 o_conv.inner = (void*)(o & (~1));
21754 o_conv.is_owned = (o & 1) || (o == 0);
21755 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21756 o_conv = ChannelAnnouncement_clone(&o_conv);
21757 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21758 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
21759 return (uintptr_t)ret_conv;
21762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21763 LDKDecodeError e_conv;
21764 e_conv.inner = (void*)(e & (~1));
21765 e_conv.is_owned = (e & 1) || (e == 0);
21766 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21767 e_conv = DecodeError_clone(&e_conv);
21768 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21769 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
21770 return (uintptr_t)ret_conv;
21773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21774 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
21775 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21780 if ((_res & 1) != 0) return;
21781 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21782 CHECK_ACCESS(_res_ptr);
21783 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21785 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
21788 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21789 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21790 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
21791 return (uintptr_t)ret_conv;
21793 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21794 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
21795 intptr_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21800 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
21801 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21802 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21803 return (uintptr_t)ret_conv;
21806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21807 LDKUnsignedChannelUpdate o_conv;
21808 o_conv.inner = (void*)(o & (~1));
21809 o_conv.is_owned = (o & 1) || (o == 0);
21810 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21811 o_conv = UnsignedChannelUpdate_clone(&o_conv);
21812 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21813 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
21814 return (uintptr_t)ret_conv;
21817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21818 LDKDecodeError e_conv;
21819 e_conv.inner = (void*)(e & (~1));
21820 e_conv.is_owned = (e & 1) || (e == 0);
21821 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21822 e_conv = DecodeError_clone(&e_conv);
21823 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21824 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
21825 return (uintptr_t)ret_conv;
21828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21829 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
21830 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
21834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21835 if ((_res & 1) != 0) return;
21836 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21837 CHECK_ACCESS(_res_ptr);
21838 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
21840 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
21843 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21844 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21845 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
21846 return (uintptr_t)ret_conv;
21848 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21849 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
21850 intptr_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21855 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
21856 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21857 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
21858 return (uintptr_t)ret_conv;
21861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21862 LDKChannelUpdate o_conv;
21863 o_conv.inner = (void*)(o & (~1));
21864 o_conv.is_owned = (o & 1) || (o == 0);
21865 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21866 o_conv = ChannelUpdate_clone(&o_conv);
21867 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21868 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
21869 return (uintptr_t)ret_conv;
21872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21873 LDKDecodeError e_conv;
21874 e_conv.inner = (void*)(e & (~1));
21875 e_conv.is_owned = (e & 1) || (e == 0);
21876 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21877 e_conv = DecodeError_clone(&e_conv);
21878 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21879 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
21880 return (uintptr_t)ret_conv;
21883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21884 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
21885 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
21889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21890 if ((_res & 1) != 0) return;
21891 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21892 CHECK_ACCESS(_res_ptr);
21893 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
21895 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
21898 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21899 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21900 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
21901 return (uintptr_t)ret_conv;
21903 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21904 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
21905 intptr_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21910 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
21911 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21912 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
21913 return (uintptr_t)ret_conv;
21916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21917 LDKErrorMessage o_conv;
21918 o_conv.inner = (void*)(o & (~1));
21919 o_conv.is_owned = (o & 1) || (o == 0);
21920 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21921 o_conv = ErrorMessage_clone(&o_conv);
21922 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21923 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
21924 return (uintptr_t)ret_conv;
21927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21928 LDKDecodeError e_conv;
21929 e_conv.inner = (void*)(e & (~1));
21930 e_conv.is_owned = (e & 1) || (e == 0);
21931 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21932 e_conv = DecodeError_clone(&e_conv);
21933 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21934 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
21935 return (uintptr_t)ret_conv;
21938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21939 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
21940 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
21944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21945 if ((_res & 1) != 0) return;
21946 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21947 CHECK_ACCESS(_res_ptr);
21948 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
21950 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
21953 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
21954 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21955 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
21956 return (uintptr_t)ret_conv;
21958 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21959 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
21960 intptr_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
21964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21965 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
21966 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21967 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
21968 return (uintptr_t)ret_conv;
21971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21972 LDKWarningMessage o_conv;
21973 o_conv.inner = (void*)(o & (~1));
21974 o_conv.is_owned = (o & 1) || (o == 0);
21975 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21976 o_conv = WarningMessage_clone(&o_conv);
21977 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21978 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
21979 return (uintptr_t)ret_conv;
21982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21983 LDKDecodeError e_conv;
21984 e_conv.inner = (void*)(e & (~1));
21985 e_conv.is_owned = (e & 1) || (e == 0);
21986 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21987 e_conv = DecodeError_clone(&e_conv);
21988 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21989 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
21990 return (uintptr_t)ret_conv;
21993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21994 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
21995 jboolean ret_val = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
21999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22000 if ((_res & 1) != 0) return;
22001 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22002 CHECK_ACCESS(_res_ptr);
22003 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
22005 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
22008 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
22009 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22010 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
22011 return (uintptr_t)ret_conv;
22013 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22014 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
22015 intptr_t ret_val = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
22019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22020 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
22021 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22022 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
22023 return (uintptr_t)ret_conv;
22026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22027 LDKUnsignedNodeAnnouncement o_conv;
22028 o_conv.inner = (void*)(o & (~1));
22029 o_conv.is_owned = (o & 1) || (o == 0);
22030 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22031 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
22032 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22033 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
22034 return (uintptr_t)ret_conv;
22037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22038 LDKDecodeError e_conv;
22039 e_conv.inner = (void*)(e & (~1));
22040 e_conv.is_owned = (e & 1) || (e == 0);
22041 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22042 e_conv = DecodeError_clone(&e_conv);
22043 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22044 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
22045 return (uintptr_t)ret_conv;
22048 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22049 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
22050 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22055 if ((_res & 1) != 0) return;
22056 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22057 CHECK_ACCESS(_res_ptr);
22058 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
22060 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
22063 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22064 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22065 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
22066 return (uintptr_t)ret_conv;
22068 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22069 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
22070 intptr_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22075 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
22076 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22077 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
22078 return (uintptr_t)ret_conv;
22081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22082 LDKNodeAnnouncement o_conv;
22083 o_conv.inner = (void*)(o & (~1));
22084 o_conv.is_owned = (o & 1) || (o == 0);
22085 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22086 o_conv = NodeAnnouncement_clone(&o_conv);
22087 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22088 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
22089 return (uintptr_t)ret_conv;
22092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22093 LDKDecodeError e_conv;
22094 e_conv.inner = (void*)(e & (~1));
22095 e_conv.is_owned = (e & 1) || (e == 0);
22096 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22097 e_conv = DecodeError_clone(&e_conv);
22098 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22099 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
22100 return (uintptr_t)ret_conv;
22103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22104 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
22105 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22110 if ((_res & 1) != 0) return;
22111 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22112 CHECK_ACCESS(_res_ptr);
22113 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
22115 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
22118 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22119 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22120 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
22121 return (uintptr_t)ret_conv;
22123 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22124 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
22125 intptr_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22130 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
22131 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22132 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
22133 return (uintptr_t)ret_conv;
22136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22137 LDKQueryShortChannelIds o_conv;
22138 o_conv.inner = (void*)(o & (~1));
22139 o_conv.is_owned = (o & 1) || (o == 0);
22140 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22141 o_conv = QueryShortChannelIds_clone(&o_conv);
22142 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22143 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
22144 return (uintptr_t)ret_conv;
22147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22148 LDKDecodeError e_conv;
22149 e_conv.inner = (void*)(e & (~1));
22150 e_conv.is_owned = (e & 1) || (e == 0);
22151 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22152 e_conv = DecodeError_clone(&e_conv);
22153 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22154 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
22155 return (uintptr_t)ret_conv;
22158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22159 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
22160 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
22164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22165 if ((_res & 1) != 0) return;
22166 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22167 CHECK_ACCESS(_res_ptr);
22168 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
22170 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
22173 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
22174 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22175 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
22176 return (uintptr_t)ret_conv;
22178 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22179 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
22180 intptr_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
22184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22185 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
22186 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22187 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
22188 return (uintptr_t)ret_conv;
22191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22192 LDKReplyShortChannelIdsEnd o_conv;
22193 o_conv.inner = (void*)(o & (~1));
22194 o_conv.is_owned = (o & 1) || (o == 0);
22195 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22196 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
22197 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22198 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
22199 return (uintptr_t)ret_conv;
22202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22203 LDKDecodeError e_conv;
22204 e_conv.inner = (void*)(e & (~1));
22205 e_conv.is_owned = (e & 1) || (e == 0);
22206 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22207 e_conv = DecodeError_clone(&e_conv);
22208 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22209 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
22210 return (uintptr_t)ret_conv;
22213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22214 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
22215 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
22219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22220 if ((_res & 1) != 0) return;
22221 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22222 CHECK_ACCESS(_res_ptr);
22223 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
22225 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
22228 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
22229 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22230 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
22231 return (uintptr_t)ret_conv;
22233 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22234 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
22235 intptr_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
22239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22240 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
22241 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22242 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
22243 return (uintptr_t)ret_conv;
22246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22247 LDKQueryChannelRange o_conv;
22248 o_conv.inner = (void*)(o & (~1));
22249 o_conv.is_owned = (o & 1) || (o == 0);
22250 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22251 o_conv = QueryChannelRange_clone(&o_conv);
22252 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22253 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
22254 return (uintptr_t)ret_conv;
22257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22258 LDKDecodeError e_conv;
22259 e_conv.inner = (void*)(e & (~1));
22260 e_conv.is_owned = (e & 1) || (e == 0);
22261 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22262 e_conv = DecodeError_clone(&e_conv);
22263 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22264 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
22265 return (uintptr_t)ret_conv;
22268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22269 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
22270 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
22274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22275 if ((_res & 1) != 0) return;
22276 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22277 CHECK_ACCESS(_res_ptr);
22278 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
22280 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
22283 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22284 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22285 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
22286 return (uintptr_t)ret_conv;
22288 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22289 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
22290 intptr_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22295 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
22296 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22297 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
22298 return (uintptr_t)ret_conv;
22301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22302 LDKReplyChannelRange o_conv;
22303 o_conv.inner = (void*)(o & (~1));
22304 o_conv.is_owned = (o & 1) || (o == 0);
22305 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22306 o_conv = ReplyChannelRange_clone(&o_conv);
22307 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22308 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
22309 return (uintptr_t)ret_conv;
22312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22313 LDKDecodeError e_conv;
22314 e_conv.inner = (void*)(e & (~1));
22315 e_conv.is_owned = (e & 1) || (e == 0);
22316 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22317 e_conv = DecodeError_clone(&e_conv);
22318 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22319 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
22320 return (uintptr_t)ret_conv;
22323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22324 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
22325 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
22329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22330 if ((_res & 1) != 0) return;
22331 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22332 CHECK_ACCESS(_res_ptr);
22333 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
22335 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
22338 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22339 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22340 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
22341 return (uintptr_t)ret_conv;
22343 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22344 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
22345 intptr_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22350 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
22351 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22352 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
22353 return (uintptr_t)ret_conv;
22356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22357 LDKGossipTimestampFilter o_conv;
22358 o_conv.inner = (void*)(o & (~1));
22359 o_conv.is_owned = (o & 1) || (o == 0);
22360 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22361 o_conv = GossipTimestampFilter_clone(&o_conv);
22362 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22363 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
22364 return (uintptr_t)ret_conv;
22367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22368 LDKDecodeError e_conv;
22369 e_conv.inner = (void*)(e & (~1));
22370 e_conv.is_owned = (e & 1) || (e == 0);
22371 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22372 e_conv = DecodeError_clone(&e_conv);
22373 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22374 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
22375 return (uintptr_t)ret_conv;
22378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22379 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
22380 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
22384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22385 if ((_res & 1) != 0) return;
22386 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22387 CHECK_ACCESS(_res_ptr);
22388 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
22390 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
22393 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
22394 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22395 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
22396 return (uintptr_t)ret_conv;
22398 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22399 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
22400 intptr_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
22404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22405 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
22406 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22407 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
22408 return (uintptr_t)ret_conv;
22411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22412 LDKCVec_PhantomRouteHintsZ _res_constr;
22413 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22414 if (_res_constr.datalen > 0)
22415 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
22417 _res_constr.data = NULL;
22418 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22419 for (size_t t = 0; t < _res_constr.datalen; t++) {
22420 int64_t _res_conv_19 = _res_vals[t];
22421 LDKPhantomRouteHints _res_conv_19_conv;
22422 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
22423 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
22424 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22425 _res_constr.data[t] = _res_conv_19_conv;
22427 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22428 CVec_PhantomRouteHintsZ_free(_res_constr);
22431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22433 o_conv.inner = (void*)(o & (~1));
22434 o_conv.is_owned = (o & 1) || (o == 0);
22435 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22436 o_conv = Invoice_clone(&o_conv);
22437 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22438 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
22439 return (uintptr_t)ret_conv;
22442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22443 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
22444 CHECK_ACCESS(e_ptr);
22445 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
22446 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
22447 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22448 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
22449 return (uintptr_t)ret_conv;
22452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22453 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
22454 jboolean ret_val = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
22458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22459 if ((_res & 1) != 0) return;
22460 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22461 CHECK_ACCESS(_res_ptr);
22462 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
22464 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
22467 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
22468 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22469 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
22470 return (uintptr_t)ret_conv;
22472 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22473 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
22474 intptr_t ret_val = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
22478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22479 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
22480 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22481 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
22482 return (uintptr_t)ret_conv;
22485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22486 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
22487 CHECK_ACCESS(o_ptr);
22488 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
22489 if (o_conv.free == LDKFilter_JCalls_free) {
22490 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22491 LDKFilter_JCalls_cloned(&o_conv);
22493 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
22494 *ret_copy = COption_FilterZ_some(o_conv);
22495 uintptr_t ret_ref = (uintptr_t)ret_copy;
22499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
22500 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
22501 *ret_copy = COption_FilterZ_none();
22502 uintptr_t ret_ref = (uintptr_t)ret_copy;
22506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22507 if ((_res & 1) != 0) return;
22508 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22509 CHECK_ACCESS(_res_ptr);
22510 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
22512 COption_FilterZ_free(_res_conv);
22515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22516 LDKLockedChannelMonitor o_conv;
22517 o_conv.inner = (void*)(o & (~1));
22518 o_conv.is_owned = (o & 1) || (o == 0);
22519 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22520 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
22521 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22522 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
22523 return (uintptr_t)ret_conv;
22526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
22527 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22528 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
22529 return (uintptr_t)ret_conv;
22532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22533 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
22534 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
22538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22539 if ((_res & 1) != 0) return;
22540 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22541 CHECK_ACCESS(_res_ptr);
22542 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
22544 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
22547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22548 LDKCVec_OutPointZ _res_constr;
22549 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22550 if (_res_constr.datalen > 0)
22551 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
22553 _res_constr.data = NULL;
22554 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22555 for (size_t k = 0; k < _res_constr.datalen; k++) {
22556 int64_t _res_conv_10 = _res_vals[k];
22557 LDKOutPoint _res_conv_10_conv;
22558 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
22559 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
22560 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
22561 _res_constr.data[k] = _res_conv_10_conv;
22563 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22564 CVec_OutPointZ_free(_res_constr);
22567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22568 if ((this_ptr & 1) != 0) return;
22569 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22570 CHECK_ACCESS(this_ptr_ptr);
22571 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
22572 FREE((void*)this_ptr);
22573 PaymentPurpose_free(this_ptr_conv);
22576 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
22577 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
22578 *ret_copy = PaymentPurpose_clone(arg);
22579 uintptr_t ret_ref = (uintptr_t)ret_copy;
22582 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22583 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
22584 intptr_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
22588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22589 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
22590 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
22591 *ret_copy = PaymentPurpose_clone(orig_conv);
22592 uintptr_t ret_ref = (uintptr_t)ret_copy;
22596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
22597 LDKThirtyTwoBytes payment_preimage_ref;
22598 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
22599 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
22600 LDKThirtyTwoBytes payment_secret_ref;
22601 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
22602 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
22603 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
22604 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
22605 uintptr_t ret_ref = (uintptr_t)ret_copy;
22609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
22610 LDKThirtyTwoBytes a_ref;
22611 CHECK((*env)->GetArrayLength(env, a) == 32);
22612 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
22613 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
22614 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
22615 uintptr_t ret_ref = (uintptr_t)ret_copy;
22619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22620 if ((this_ptr & 1) != 0) return;
22621 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22622 CHECK_ACCESS(this_ptr_ptr);
22623 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
22624 FREE((void*)this_ptr);
22625 ClosureReason_free(this_ptr_conv);
22628 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
22629 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22630 *ret_copy = ClosureReason_clone(arg);
22631 uintptr_t ret_ref = (uintptr_t)ret_copy;
22634 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22635 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
22636 intptr_t ret_val = ClosureReason_clone_ptr(arg_conv);
22640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22641 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
22642 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22643 *ret_copy = ClosureReason_clone(orig_conv);
22644 uintptr_t ret_ref = (uintptr_t)ret_copy;
22648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
22649 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
22650 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22651 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
22652 uintptr_t ret_ref = (uintptr_t)ret_copy;
22656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
22657 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22658 *ret_copy = ClosureReason_holder_force_closed();
22659 uintptr_t ret_ref = (uintptr_t)ret_copy;
22663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
22664 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22665 *ret_copy = ClosureReason_cooperative_closure();
22666 uintptr_t ret_ref = (uintptr_t)ret_copy;
22670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
22671 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22672 *ret_copy = ClosureReason_commitment_tx_confirmed();
22673 uintptr_t ret_ref = (uintptr_t)ret_copy;
22677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
22678 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22679 *ret_copy = ClosureReason_funding_timed_out();
22680 uintptr_t ret_ref = (uintptr_t)ret_copy;
22684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
22685 LDKStr err_conv = java_to_owned_str(env, err);
22686 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22687 *ret_copy = ClosureReason_processing_error(err_conv);
22688 uintptr_t ret_ref = (uintptr_t)ret_copy;
22692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
22693 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22694 *ret_copy = ClosureReason_disconnected_peer();
22695 uintptr_t ret_ref = (uintptr_t)ret_copy;
22699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
22700 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22701 *ret_copy = ClosureReason_outdated_channel_manager();
22702 uintptr_t ret_ref = (uintptr_t)ret_copy;
22706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
22707 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
22708 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
22709 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22710 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22711 CVec_u8Z_free(ret_var);
22715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22716 LDKu8slice ser_ref;
22717 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22718 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22719 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
22720 *ret_conv = ClosureReason_read(ser_ref);
22721 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22722 return (uintptr_t)ret_conv;
22725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22726 if ((this_ptr & 1) != 0) return;
22727 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22728 CHECK_ACCESS(this_ptr_ptr);
22729 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
22730 FREE((void*)this_ptr);
22731 Event_free(this_ptr_conv);
22734 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
22735 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22736 *ret_copy = Event_clone(arg);
22737 uintptr_t ret_ref = (uintptr_t)ret_copy;
22740 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22741 LDKEvent* arg_conv = (LDKEvent*)arg;
22742 intptr_t ret_val = Event_clone_ptr(arg_conv);
22746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22747 LDKEvent* orig_conv = (LDKEvent*)orig;
22748 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22749 *ret_copy = Event_clone(orig_conv);
22750 uintptr_t ret_ref = (uintptr_t)ret_copy;
22754 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) {
22755 LDKThirtyTwoBytes temporary_channel_id_ref;
22756 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
22757 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
22758 LDKCVec_u8Z output_script_ref;
22759 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
22760 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
22761 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
22762 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22763 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
22764 uintptr_t ret_ref = (uintptr_t)ret_copy;
22768 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) {
22769 LDKThirtyTwoBytes payment_hash_ref;
22770 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
22771 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
22772 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
22773 CHECK_ACCESS(purpose_ptr);
22774 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
22775 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
22776 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22777 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
22778 uintptr_t ret_ref = (uintptr_t)ret_copy;
22782 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) {
22783 LDKThirtyTwoBytes payment_id_ref;
22784 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
22785 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
22786 LDKThirtyTwoBytes payment_preimage_ref;
22787 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
22788 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
22789 LDKThirtyTwoBytes payment_hash_ref;
22790 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
22791 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
22792 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
22793 CHECK_ACCESS(fee_paid_msat_ptr);
22794 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
22795 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
22796 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22797 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
22798 uintptr_t ret_ref = (uintptr_t)ret_copy;
22802 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) {
22803 LDKThirtyTwoBytes payment_id_ref;
22804 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
22805 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
22806 LDKThirtyTwoBytes payment_hash_ref;
22807 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
22808 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
22809 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
22810 CHECK_ACCESS(network_update_ptr);
22811 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
22812 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
22813 LDKCVec_RouteHopZ path_constr;
22814 path_constr.datalen = (*env)->GetArrayLength(env, path);
22815 if (path_constr.datalen > 0)
22816 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22818 path_constr.data = NULL;
22819 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
22820 for (size_t k = 0; k < path_constr.datalen; k++) {
22821 int64_t path_conv_10 = path_vals[k];
22822 LDKRouteHop path_conv_10_conv;
22823 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
22824 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
22825 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22826 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22827 path_constr.data[k] = path_conv_10_conv;
22829 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
22830 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
22831 CHECK_ACCESS(short_channel_id_ptr);
22832 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
22833 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
22834 LDKRouteParameters retry_conv;
22835 retry_conv.inner = (void*)(retry & (~1));
22836 retry_conv.is_owned = (retry & 1) || (retry == 0);
22837 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
22838 retry_conv = RouteParameters_clone(&retry_conv);
22839 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22840 *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);
22841 uintptr_t ret_ref = (uintptr_t)ret_copy;
22845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
22846 LDKThirtyTwoBytes payment_id_ref;
22847 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
22848 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
22849 LDKThirtyTwoBytes payment_hash_ref;
22850 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
22851 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
22852 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22853 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
22854 uintptr_t ret_ref = (uintptr_t)ret_copy;
22858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
22859 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22860 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
22861 uintptr_t ret_ref = (uintptr_t)ret_copy;
22865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
22866 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
22867 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
22868 if (outputs_constr.datalen > 0)
22869 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
22871 outputs_constr.data = NULL;
22872 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
22873 for (size_t b = 0; b < outputs_constr.datalen; b++) {
22874 int64_t outputs_conv_27 = outputs_vals[b];
22875 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
22876 CHECK_ACCESS(outputs_conv_27_ptr);
22877 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
22878 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
22879 outputs_constr.data[b] = outputs_conv_27_conv;
22881 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
22882 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22883 *ret_copy = Event_spendable_outputs(outputs_constr);
22884 uintptr_t ret_ref = (uintptr_t)ret_copy;
22888 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) {
22889 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
22890 CHECK_ACCESS(fee_earned_msat_ptr);
22891 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
22892 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
22893 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22894 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
22895 uintptr_t ret_ref = (uintptr_t)ret_copy;
22899 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) {
22900 LDKThirtyTwoBytes channel_id_ref;
22901 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
22902 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
22903 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
22904 CHECK_ACCESS(reason_ptr);
22905 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
22906 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
22907 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22908 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
22909 uintptr_t ret_ref = (uintptr_t)ret_copy;
22913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
22914 LDKThirtyTwoBytes channel_id_ref;
22915 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
22916 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
22917 LDKTransaction transaction_ref;
22918 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
22919 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
22920 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
22921 transaction_ref.data_is_owned = true;
22922 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22923 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
22924 uintptr_t ret_ref = (uintptr_t)ret_copy;
22928 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) {
22929 LDKThirtyTwoBytes payment_id_ref;
22930 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
22931 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
22932 LDKThirtyTwoBytes payment_hash_ref;
22933 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
22934 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
22935 LDKCVec_RouteHopZ path_constr;
22936 path_constr.datalen = (*env)->GetArrayLength(env, path);
22937 if (path_constr.datalen > 0)
22938 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22940 path_constr.data = NULL;
22941 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
22942 for (size_t k = 0; k < path_constr.datalen; k++) {
22943 int64_t path_conv_10 = path_vals[k];
22944 LDKRouteHop path_conv_10_conv;
22945 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
22946 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
22947 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22948 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22949 path_constr.data[k] = path_conv_10_conv;
22951 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
22952 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22953 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
22954 uintptr_t ret_ref = (uintptr_t)ret_copy;
22958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat) {
22959 LDKThirtyTwoBytes temporary_channel_id_ref;
22960 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
22961 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
22962 LDKPublicKey counterparty_node_id_ref;
22963 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
22964 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
22965 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22966 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat);
22967 uintptr_t ret_ref = (uintptr_t)ret_copy;
22971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
22972 LDKEvent* obj_conv = (LDKEvent*)obj;
22973 LDKCVec_u8Z ret_var = Event_write(obj_conv);
22974 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22975 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22976 CVec_u8Z_free(ret_var);
22980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22981 LDKu8slice ser_ref;
22982 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22983 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22984 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
22985 *ret_conv = Event_read(ser_ref);
22986 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22987 return (uintptr_t)ret_conv;
22990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22991 if ((this_ptr & 1) != 0) return;
22992 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22993 CHECK_ACCESS(this_ptr_ptr);
22994 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
22995 FREE((void*)this_ptr);
22996 MessageSendEvent_free(this_ptr_conv);
22999 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
23000 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23001 *ret_copy = MessageSendEvent_clone(arg);
23002 uintptr_t ret_ref = (uintptr_t)ret_copy;
23005 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23006 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
23007 intptr_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
23011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23012 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
23013 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23014 *ret_copy = MessageSendEvent_clone(orig_conv);
23015 uintptr_t ret_ref = (uintptr_t)ret_copy;
23019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23020 LDKPublicKey node_id_ref;
23021 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23022 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23023 LDKAcceptChannel msg_conv;
23024 msg_conv.inner = (void*)(msg & (~1));
23025 msg_conv.is_owned = (msg & 1) || (msg == 0);
23026 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23027 msg_conv = AcceptChannel_clone(&msg_conv);
23028 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23029 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
23030 uintptr_t ret_ref = (uintptr_t)ret_copy;
23034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23035 LDKPublicKey node_id_ref;
23036 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23037 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23038 LDKOpenChannel msg_conv;
23039 msg_conv.inner = (void*)(msg & (~1));
23040 msg_conv.is_owned = (msg & 1) || (msg == 0);
23041 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23042 msg_conv = OpenChannel_clone(&msg_conv);
23043 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23044 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
23045 uintptr_t ret_ref = (uintptr_t)ret_copy;
23049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23050 LDKPublicKey node_id_ref;
23051 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23052 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23053 LDKFundingCreated msg_conv;
23054 msg_conv.inner = (void*)(msg & (~1));
23055 msg_conv.is_owned = (msg & 1) || (msg == 0);
23056 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23057 msg_conv = FundingCreated_clone(&msg_conv);
23058 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23059 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
23060 uintptr_t ret_ref = (uintptr_t)ret_copy;
23064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23065 LDKPublicKey node_id_ref;
23066 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23067 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23068 LDKFundingSigned msg_conv;
23069 msg_conv.inner = (void*)(msg & (~1));
23070 msg_conv.is_owned = (msg & 1) || (msg == 0);
23071 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23072 msg_conv = FundingSigned_clone(&msg_conv);
23073 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23074 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
23075 uintptr_t ret_ref = (uintptr_t)ret_copy;
23079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23080 LDKPublicKey node_id_ref;
23081 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23082 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23083 LDKFundingLocked msg_conv;
23084 msg_conv.inner = (void*)(msg & (~1));
23085 msg_conv.is_owned = (msg & 1) || (msg == 0);
23086 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23087 msg_conv = FundingLocked_clone(&msg_conv);
23088 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23089 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
23090 uintptr_t ret_ref = (uintptr_t)ret_copy;
23094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23095 LDKPublicKey node_id_ref;
23096 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23097 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23098 LDKAnnouncementSignatures msg_conv;
23099 msg_conv.inner = (void*)(msg & (~1));
23100 msg_conv.is_owned = (msg & 1) || (msg == 0);
23101 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23102 msg_conv = AnnouncementSignatures_clone(&msg_conv);
23103 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23104 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
23105 uintptr_t ret_ref = (uintptr_t)ret_copy;
23109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
23110 LDKPublicKey node_id_ref;
23111 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23112 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23113 LDKCommitmentUpdate updates_conv;
23114 updates_conv.inner = (void*)(updates & (~1));
23115 updates_conv.is_owned = (updates & 1) || (updates == 0);
23116 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
23117 updates_conv = CommitmentUpdate_clone(&updates_conv);
23118 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23119 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
23120 uintptr_t ret_ref = (uintptr_t)ret_copy;
23124 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) {
23125 LDKPublicKey node_id_ref;
23126 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23127 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23128 LDKRevokeAndACK msg_conv;
23129 msg_conv.inner = (void*)(msg & (~1));
23130 msg_conv.is_owned = (msg & 1) || (msg == 0);
23131 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23132 msg_conv = RevokeAndACK_clone(&msg_conv);
23133 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23134 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
23135 uintptr_t ret_ref = (uintptr_t)ret_copy;
23139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23140 LDKPublicKey node_id_ref;
23141 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23142 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23143 LDKClosingSigned msg_conv;
23144 msg_conv.inner = (void*)(msg & (~1));
23145 msg_conv.is_owned = (msg & 1) || (msg == 0);
23146 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23147 msg_conv = ClosingSigned_clone(&msg_conv);
23148 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23149 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
23150 uintptr_t ret_ref = (uintptr_t)ret_copy;
23154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23155 LDKPublicKey node_id_ref;
23156 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23157 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23158 LDKShutdown msg_conv;
23159 msg_conv.inner = (void*)(msg & (~1));
23160 msg_conv.is_owned = (msg & 1) || (msg == 0);
23161 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23162 msg_conv = Shutdown_clone(&msg_conv);
23163 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23164 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
23165 uintptr_t ret_ref = (uintptr_t)ret_copy;
23169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23170 LDKPublicKey node_id_ref;
23171 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23172 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23173 LDKChannelReestablish msg_conv;
23174 msg_conv.inner = (void*)(msg & (~1));
23175 msg_conv.is_owned = (msg & 1) || (msg == 0);
23176 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23177 msg_conv = ChannelReestablish_clone(&msg_conv);
23178 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23179 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
23180 uintptr_t ret_ref = (uintptr_t)ret_copy;
23184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
23185 LDKChannelAnnouncement msg_conv;
23186 msg_conv.inner = (void*)(msg & (~1));
23187 msg_conv.is_owned = (msg & 1) || (msg == 0);
23188 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23189 msg_conv = ChannelAnnouncement_clone(&msg_conv);
23190 LDKChannelUpdate update_msg_conv;
23191 update_msg_conv.inner = (void*)(update_msg & (~1));
23192 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
23193 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
23194 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
23195 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23196 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
23197 uintptr_t ret_ref = (uintptr_t)ret_copy;
23201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
23202 LDKNodeAnnouncement msg_conv;
23203 msg_conv.inner = (void*)(msg & (~1));
23204 msg_conv.is_owned = (msg & 1) || (msg == 0);
23205 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23206 msg_conv = NodeAnnouncement_clone(&msg_conv);
23207 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23208 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
23209 uintptr_t ret_ref = (uintptr_t)ret_copy;
23213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
23214 LDKChannelUpdate msg_conv;
23215 msg_conv.inner = (void*)(msg & (~1));
23216 msg_conv.is_owned = (msg & 1) || (msg == 0);
23217 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23218 msg_conv = ChannelUpdate_clone(&msg_conv);
23219 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23220 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
23221 uintptr_t ret_ref = (uintptr_t)ret_copy;
23225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23226 LDKPublicKey node_id_ref;
23227 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23228 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23229 LDKChannelUpdate msg_conv;
23230 msg_conv.inner = (void*)(msg & (~1));
23231 msg_conv.is_owned = (msg & 1) || (msg == 0);
23232 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23233 msg_conv = ChannelUpdate_clone(&msg_conv);
23234 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23235 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
23236 uintptr_t ret_ref = (uintptr_t)ret_copy;
23240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
23241 LDKPublicKey node_id_ref;
23242 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23243 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23244 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
23245 CHECK_ACCESS(action_ptr);
23246 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
23247 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
23248 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23249 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
23250 uintptr_t ret_ref = (uintptr_t)ret_copy;
23254 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) {
23255 LDKPublicKey node_id_ref;
23256 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23257 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23258 LDKQueryChannelRange msg_conv;
23259 msg_conv.inner = (void*)(msg & (~1));
23260 msg_conv.is_owned = (msg & 1) || (msg == 0);
23261 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23262 msg_conv = QueryChannelRange_clone(&msg_conv);
23263 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23264 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
23265 uintptr_t ret_ref = (uintptr_t)ret_copy;
23269 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) {
23270 LDKPublicKey node_id_ref;
23271 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23272 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23273 LDKQueryShortChannelIds msg_conv;
23274 msg_conv.inner = (void*)(msg & (~1));
23275 msg_conv.is_owned = (msg & 1) || (msg == 0);
23276 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23277 msg_conv = QueryShortChannelIds_clone(&msg_conv);
23278 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23279 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
23280 uintptr_t ret_ref = (uintptr_t)ret_copy;
23284 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) {
23285 LDKPublicKey node_id_ref;
23286 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23287 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23288 LDKReplyChannelRange msg_conv;
23289 msg_conv.inner = (void*)(msg & (~1));
23290 msg_conv.is_owned = (msg & 1) || (msg == 0);
23291 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23292 msg_conv = ReplyChannelRange_clone(&msg_conv);
23293 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23294 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
23295 uintptr_t ret_ref = (uintptr_t)ret_copy;
23299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23300 if ((this_ptr & 1) != 0) return;
23301 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23302 CHECK_ACCESS(this_ptr_ptr);
23303 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
23304 FREE((void*)this_ptr);
23305 MessageSendEventsProvider_free(this_ptr_conv);
23308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23309 if ((this_ptr & 1) != 0) return;
23310 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23311 CHECK_ACCESS(this_ptr_ptr);
23312 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
23313 FREE((void*)this_ptr);
23314 EventsProvider_free(this_ptr_conv);
23317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23318 if ((this_ptr & 1) != 0) return;
23319 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23320 CHECK_ACCESS(this_ptr_ptr);
23321 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
23322 FREE((void*)this_ptr);
23323 EventHandler_free(this_ptr_conv);
23326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23327 if ((this_ptr & 1) != 0) return;
23328 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23329 CHECK_ACCESS(this_ptr_ptr);
23330 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
23331 FREE((void*)this_ptr);
23332 APIError_free(this_ptr_conv);
23335 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
23336 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23337 *ret_copy = APIError_clone(arg);
23338 uintptr_t ret_ref = (uintptr_t)ret_copy;
23341 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23342 LDKAPIError* arg_conv = (LDKAPIError*)arg;
23343 intptr_t ret_val = APIError_clone_ptr(arg_conv);
23347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23348 LDKAPIError* orig_conv = (LDKAPIError*)orig;
23349 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23350 *ret_copy = APIError_clone(orig_conv);
23351 uintptr_t ret_ref = (uintptr_t)ret_copy;
23355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
23356 LDKStr err_conv = java_to_owned_str(env, err);
23357 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23358 *ret_copy = APIError_apimisuse_error(err_conv);
23359 uintptr_t ret_ref = (uintptr_t)ret_copy;
23363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
23364 LDKStr err_conv = java_to_owned_str(env, err);
23365 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23366 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
23367 uintptr_t ret_ref = (uintptr_t)ret_copy;
23371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
23372 LDKStr err_conv = java_to_owned_str(env, err);
23373 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23374 *ret_copy = APIError_route_error(err_conv);
23375 uintptr_t ret_ref = (uintptr_t)ret_copy;
23379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
23380 LDKStr err_conv = java_to_owned_str(env, err);
23381 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23382 *ret_copy = APIError_channel_unavailable(err_conv);
23383 uintptr_t ret_ref = (uintptr_t)ret_copy;
23387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
23388 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23389 *ret_copy = APIError_monitor_update_failed();
23390 uintptr_t ret_ref = (uintptr_t)ret_copy;
23394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
23395 LDKShutdownScript script_conv;
23396 script_conv.inner = (void*)(script & (~1));
23397 script_conv.is_owned = (script & 1) || (script == 0);
23398 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
23399 script_conv = ShutdownScript_clone(&script_conv);
23400 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23401 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
23402 uintptr_t ret_ref = (uintptr_t)ret_copy;
23406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
23407 LDKu8slice msg_ref;
23408 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23409 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23410 unsigned char sk_arr[32];
23411 CHECK((*env)->GetArrayLength(env, sk) == 32);
23412 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
23413 unsigned char (*sk_ref)[32] = &sk_arr;
23414 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
23415 *ret_conv = sign(msg_ref, sk_ref);
23416 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23417 return (uintptr_t)ret_conv;
23420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
23421 LDKu8slice msg_ref;
23422 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23423 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23424 LDKStr sig_conv = java_to_owned_str(env, sig);
23425 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
23426 *ret_conv = recover_pk(msg_ref, sig_conv);
23427 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23428 return (uintptr_t)ret_conv;
23431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
23432 LDKu8slice msg_ref;
23433 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23434 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23435 LDKStr sig_conv = java_to_owned_str(env, sig);
23436 LDKPublicKey pk_ref;
23437 CHECK((*env)->GetArrayLength(env, pk) == 33);
23438 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
23439 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
23440 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
23445 LDKu8slice hrp_bytes_ref;
23446 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
23447 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
23448 LDKCVec_u5Z data_without_signature_constr;
23449 data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
23450 if (data_without_signature_constr.datalen > 0)
23451 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
23453 data_without_signature_constr.data = NULL;
23454 int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
23455 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
23456 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
23458 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
23460 (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
23461 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
23462 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23463 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23464 CVec_u8Z_free(ret_var);
23465 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
23469 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23470 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
23471 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
23475 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
23476 jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
23480 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
23481 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
23485 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
23486 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
23490 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
23491 jclass ret_conv = LDKLevel_to_java(env, Level_info());
23495 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
23496 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
23500 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
23501 jclass ret_conv = LDKLevel_to_java(env, Level_error());
23505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23506 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
23507 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
23508 jboolean ret_val = Level_eq(a_conv, b_conv);
23512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
23513 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
23514 int64_t ret_val = Level_hash(o_conv);
23518 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
23519 jclass ret_conv = LDKLevel_to_java(env, Level_max());
23523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23524 LDKRecord this_obj_conv;
23525 this_obj_conv.inner = (void*)(this_obj & (~1));
23526 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23528 Record_free(this_obj_conv);
23531 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
23532 LDKRecord this_ptr_conv;
23533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23534 this_ptr_conv.is_owned = false;
23535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23536 jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
23540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
23541 LDKRecord this_ptr_conv;
23542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23543 this_ptr_conv.is_owned = false;
23544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23545 LDKLevel val_conv = LDKLevel_from_java(env, val);
23546 Record_set_level(&this_ptr_conv, val_conv);
23549 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
23550 LDKRecord this_ptr_conv;
23551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23552 this_ptr_conv.is_owned = false;
23553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23554 LDKStr ret_str = Record_get_args(&this_ptr_conv);
23555 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
23561 LDKRecord this_ptr_conv;
23562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23563 this_ptr_conv.is_owned = false;
23564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23565 LDKStr val_conv = java_to_owned_str(env, val);
23566 Record_set_args(&this_ptr_conv, val_conv);
23569 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
23570 LDKRecord this_ptr_conv;
23571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23572 this_ptr_conv.is_owned = false;
23573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23574 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
23575 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
23581 LDKRecord this_ptr_conv;
23582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23583 this_ptr_conv.is_owned = false;
23584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23585 LDKStr val_conv = java_to_owned_str(env, val);
23586 Record_set_module_path(&this_ptr_conv, val_conv);
23589 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
23590 LDKRecord this_ptr_conv;
23591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23592 this_ptr_conv.is_owned = false;
23593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23594 LDKStr ret_str = Record_get_file(&this_ptr_conv);
23595 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
23601 LDKRecord this_ptr_conv;
23602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23603 this_ptr_conv.is_owned = false;
23604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23605 LDKStr val_conv = java_to_owned_str(env, val);
23606 Record_set_file(&this_ptr_conv, val_conv);
23609 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
23610 LDKRecord this_ptr_conv;
23611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23612 this_ptr_conv.is_owned = false;
23613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23614 int32_t ret_val = Record_get_line(&this_ptr_conv);
23618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23619 LDKRecord this_ptr_conv;
23620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23621 this_ptr_conv.is_owned = false;
23622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23623 Record_set_line(&this_ptr_conv, val);
23626 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
23627 LDKRecord ret_var = Record_clone(arg);
23628 uintptr_t ret_ref = 0;
23629 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23630 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23632 ret_ref = (uintptr_t)ret_var.inner;
23633 if (ret_var.is_owned) {
23638 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23639 LDKRecord arg_conv;
23640 arg_conv.inner = (void*)(arg & (~1));
23641 arg_conv.is_owned = false;
23642 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23643 intptr_t ret_val = Record_clone_ptr(&arg_conv);
23647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23648 LDKRecord orig_conv;
23649 orig_conv.inner = (void*)(orig & (~1));
23650 orig_conv.is_owned = false;
23651 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23652 LDKRecord ret_var = Record_clone(&orig_conv);
23653 uintptr_t ret_ref = 0;
23654 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23655 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23657 ret_ref = (uintptr_t)ret_var.inner;
23658 if (ret_var.is_owned) {
23664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23665 if ((this_ptr & 1) != 0) return;
23666 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23667 CHECK_ACCESS(this_ptr_ptr);
23668 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
23669 FREE((void*)this_ptr);
23670 Logger_free(this_ptr_conv);
23673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23674 LDKChannelHandshakeConfig this_obj_conv;
23675 this_obj_conv.inner = (void*)(this_obj & (~1));
23676 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23678 ChannelHandshakeConfig_free(this_obj_conv);
23681 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
23682 LDKChannelHandshakeConfig this_ptr_conv;
23683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23684 this_ptr_conv.is_owned = false;
23685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23686 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
23690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23691 LDKChannelHandshakeConfig this_ptr_conv;
23692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23693 this_ptr_conv.is_owned = false;
23694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23695 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
23698 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
23699 LDKChannelHandshakeConfig this_ptr_conv;
23700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23701 this_ptr_conv.is_owned = false;
23702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23703 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
23707 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) {
23708 LDKChannelHandshakeConfig this_ptr_conv;
23709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23710 this_ptr_conv.is_owned = false;
23711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23712 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
23715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23716 LDKChannelHandshakeConfig this_ptr_conv;
23717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23718 this_ptr_conv.is_owned = false;
23719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23720 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
23724 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) {
23725 LDKChannelHandshakeConfig this_ptr_conv;
23726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23727 this_ptr_conv.is_owned = false;
23728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23729 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
23732 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) {
23733 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
23734 uintptr_t ret_ref = 0;
23735 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23736 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23738 ret_ref = (uintptr_t)ret_var.inner;
23739 if (ret_var.is_owned) {
23745 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
23746 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
23747 uintptr_t ret_ref = 0;
23748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23751 ret_ref = (uintptr_t)ret_var.inner;
23752 if (ret_var.is_owned) {
23757 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23758 LDKChannelHandshakeConfig arg_conv;
23759 arg_conv.inner = (void*)(arg & (~1));
23760 arg_conv.is_owned = false;
23761 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23762 intptr_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
23766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23767 LDKChannelHandshakeConfig orig_conv;
23768 orig_conv.inner = (void*)(orig & (~1));
23769 orig_conv.is_owned = false;
23770 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23771 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
23772 uintptr_t ret_ref = 0;
23773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23776 ret_ref = (uintptr_t)ret_var.inner;
23777 if (ret_var.is_owned) {
23783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
23784 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
23785 uintptr_t ret_ref = 0;
23786 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23787 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23789 ret_ref = (uintptr_t)ret_var.inner;
23790 if (ret_var.is_owned) {
23796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23797 LDKChannelHandshakeLimits this_obj_conv;
23798 this_obj_conv.inner = (void*)(this_obj & (~1));
23799 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23801 ChannelHandshakeLimits_free(this_obj_conv);
23804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
23805 LDKChannelHandshakeLimits this_ptr_conv;
23806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23807 this_ptr_conv.is_owned = false;
23808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23809 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
23813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23814 LDKChannelHandshakeLimits this_ptr_conv;
23815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23816 this_ptr_conv.is_owned = false;
23817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23818 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
23821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23822 LDKChannelHandshakeLimits this_ptr_conv;
23823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23824 this_ptr_conv.is_owned = false;
23825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23826 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
23830 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) {
23831 LDKChannelHandshakeLimits this_ptr_conv;
23832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23833 this_ptr_conv.is_owned = false;
23834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23835 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
23838 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) {
23839 LDKChannelHandshakeLimits this_ptr_conv;
23840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23841 this_ptr_conv.is_owned = false;
23842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23843 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
23847 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) {
23848 LDKChannelHandshakeLimits this_ptr_conv;
23849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23850 this_ptr_conv.is_owned = false;
23851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23852 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
23856 LDKChannelHandshakeLimits this_ptr_conv;
23857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23858 this_ptr_conv.is_owned = false;
23859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23860 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
23864 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) {
23865 LDKChannelHandshakeLimits this_ptr_conv;
23866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23867 this_ptr_conv.is_owned = false;
23868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23869 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
23872 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
23873 LDKChannelHandshakeLimits this_ptr_conv;
23874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23875 this_ptr_conv.is_owned = false;
23876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23877 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
23881 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) {
23882 LDKChannelHandshakeLimits this_ptr_conv;
23883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23884 this_ptr_conv.is_owned = false;
23885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23886 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
23889 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
23890 LDKChannelHandshakeLimits this_ptr_conv;
23891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23892 this_ptr_conv.is_owned = false;
23893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23894 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
23898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23899 LDKChannelHandshakeLimits this_ptr_conv;
23900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23901 this_ptr_conv.is_owned = false;
23902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23903 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
23906 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
23907 LDKChannelHandshakeLimits this_ptr_conv;
23908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23909 this_ptr_conv.is_owned = false;
23910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23911 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
23915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23916 LDKChannelHandshakeLimits this_ptr_conv;
23917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23918 this_ptr_conv.is_owned = false;
23919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23920 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
23923 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
23924 LDKChannelHandshakeLimits this_ptr_conv;
23925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23926 this_ptr_conv.is_owned = false;
23927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23928 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
23932 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) {
23933 LDKChannelHandshakeLimits this_ptr_conv;
23934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23935 this_ptr_conv.is_owned = false;
23936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23937 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
23940 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) {
23941 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);
23942 uintptr_t ret_ref = 0;
23943 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23944 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23946 ret_ref = (uintptr_t)ret_var.inner;
23947 if (ret_var.is_owned) {
23953 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
23954 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
23955 uintptr_t ret_ref = 0;
23956 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23957 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23959 ret_ref = (uintptr_t)ret_var.inner;
23960 if (ret_var.is_owned) {
23965 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23966 LDKChannelHandshakeLimits arg_conv;
23967 arg_conv.inner = (void*)(arg & (~1));
23968 arg_conv.is_owned = false;
23969 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23970 intptr_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
23974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23975 LDKChannelHandshakeLimits orig_conv;
23976 orig_conv.inner = (void*)(orig & (~1));
23977 orig_conv.is_owned = false;
23978 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23979 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
23980 uintptr_t ret_ref = 0;
23981 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23982 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23983 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23984 ret_ref = (uintptr_t)ret_var.inner;
23985 if (ret_var.is_owned) {
23991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
23992 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
23993 uintptr_t ret_ref = 0;
23994 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23995 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23997 ret_ref = (uintptr_t)ret_var.inner;
23998 if (ret_var.is_owned) {
24004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24005 LDKChannelConfig this_obj_conv;
24006 this_obj_conv.inner = (void*)(this_obj & (~1));
24007 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24009 ChannelConfig_free(this_obj_conv);
24012 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
24013 LDKChannelConfig this_ptr_conv;
24014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24015 this_ptr_conv.is_owned = false;
24016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24017 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
24021 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) {
24022 LDKChannelConfig this_ptr_conv;
24023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24024 this_ptr_conv.is_owned = false;
24025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24026 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
24029 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24030 LDKChannelConfig this_ptr_conv;
24031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24032 this_ptr_conv.is_owned = false;
24033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24034 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
24038 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) {
24039 LDKChannelConfig this_ptr_conv;
24040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24041 this_ptr_conv.is_owned = false;
24042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24043 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
24046 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24047 LDKChannelConfig this_ptr_conv;
24048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24049 this_ptr_conv.is_owned = false;
24050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24051 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
24055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
24056 LDKChannelConfig this_ptr_conv;
24057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24058 this_ptr_conv.is_owned = false;
24059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24060 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
24063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
24064 LDKChannelConfig this_ptr_conv;
24065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24066 this_ptr_conv.is_owned = false;
24067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24068 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
24072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24073 LDKChannelConfig this_ptr_conv;
24074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24075 this_ptr_conv.is_owned = false;
24076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24077 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
24080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24081 LDKChannelConfig this_ptr_conv;
24082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24083 this_ptr_conv.is_owned = false;
24084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24085 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
24089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24090 LDKChannelConfig this_ptr_conv;
24091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24092 this_ptr_conv.is_owned = false;
24093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24094 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
24097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24098 LDKChannelConfig this_ptr_conv;
24099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24100 this_ptr_conv.is_owned = false;
24101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24102 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
24106 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) {
24107 LDKChannelConfig this_ptr_conv;
24108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24109 this_ptr_conv.is_owned = false;
24110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24111 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
24114 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) {
24115 LDKChannelConfig this_ptr_conv;
24116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24117 this_ptr_conv.is_owned = false;
24118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24119 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
24123 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) {
24124 LDKChannelConfig this_ptr_conv;
24125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24126 this_ptr_conv.is_owned = false;
24127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24128 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
24131 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) {
24132 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);
24133 uintptr_t ret_ref = 0;
24134 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24135 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24137 ret_ref = (uintptr_t)ret_var.inner;
24138 if (ret_var.is_owned) {
24144 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
24145 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
24146 uintptr_t ret_ref = 0;
24147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24150 ret_ref = (uintptr_t)ret_var.inner;
24151 if (ret_var.is_owned) {
24156 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24157 LDKChannelConfig arg_conv;
24158 arg_conv.inner = (void*)(arg & (~1));
24159 arg_conv.is_owned = false;
24160 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24161 intptr_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
24165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24166 LDKChannelConfig orig_conv;
24167 orig_conv.inner = (void*)(orig & (~1));
24168 orig_conv.is_owned = false;
24169 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24170 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
24171 uintptr_t ret_ref = 0;
24172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24175 ret_ref = (uintptr_t)ret_var.inner;
24176 if (ret_var.is_owned) {
24182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
24183 LDKChannelConfig ret_var = ChannelConfig_default();
24184 uintptr_t ret_ref = 0;
24185 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24186 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24188 ret_ref = (uintptr_t)ret_var.inner;
24189 if (ret_var.is_owned) {
24195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
24196 LDKChannelConfig obj_conv;
24197 obj_conv.inner = (void*)(obj & (~1));
24198 obj_conv.is_owned = false;
24199 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24200 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24201 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24202 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24203 CVec_u8Z_free(ret_var);
24207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24208 LDKu8slice ser_ref;
24209 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24210 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24211 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
24212 *ret_conv = ChannelConfig_read(ser_ref);
24213 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24214 return (uintptr_t)ret_conv;
24217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24218 LDKUserConfig 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 UserConfig_free(this_obj_conv);
24225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
24226 LDKUserConfig this_ptr_conv;
24227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24228 this_ptr_conv.is_owned = false;
24229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24230 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
24231 uintptr_t ret_ref = 0;
24232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24235 ret_ref = (uintptr_t)ret_var.inner;
24236 if (ret_var.is_owned) {
24242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24243 LDKUserConfig this_ptr_conv;
24244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24245 this_ptr_conv.is_owned = false;
24246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24247 LDKChannelHandshakeConfig val_conv;
24248 val_conv.inner = (void*)(val & (~1));
24249 val_conv.is_owned = (val & 1) || (val == 0);
24250 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24251 val_conv = ChannelHandshakeConfig_clone(&val_conv);
24252 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
24255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
24256 LDKUserConfig this_ptr_conv;
24257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24258 this_ptr_conv.is_owned = false;
24259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24260 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
24261 uintptr_t ret_ref = 0;
24262 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24263 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24264 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24265 ret_ref = (uintptr_t)ret_var.inner;
24266 if (ret_var.is_owned) {
24272 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) {
24273 LDKUserConfig this_ptr_conv;
24274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24275 this_ptr_conv.is_owned = false;
24276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24277 LDKChannelHandshakeLimits val_conv;
24278 val_conv.inner = (void*)(val & (~1));
24279 val_conv.is_owned = (val & 1) || (val == 0);
24280 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24281 val_conv = ChannelHandshakeLimits_clone(&val_conv);
24282 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
24285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
24286 LDKUserConfig this_ptr_conv;
24287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24288 this_ptr_conv.is_owned = false;
24289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24290 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
24291 uintptr_t ret_ref = 0;
24292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24295 ret_ref = (uintptr_t)ret_var.inner;
24296 if (ret_var.is_owned) {
24302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24303 LDKUserConfig this_ptr_conv;
24304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24305 this_ptr_conv.is_owned = false;
24306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24307 LDKChannelConfig val_conv;
24308 val_conv.inner = (void*)(val & (~1));
24309 val_conv.is_owned = (val & 1) || (val == 0);
24310 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24311 val_conv = ChannelConfig_clone(&val_conv);
24312 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
24315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24316 LDKUserConfig this_ptr_conv;
24317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24318 this_ptr_conv.is_owned = false;
24319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24320 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
24324 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) {
24325 LDKUserConfig this_ptr_conv;
24326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24327 this_ptr_conv.is_owned = false;
24328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24329 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
24332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24333 LDKUserConfig this_ptr_conv;
24334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24335 this_ptr_conv.is_owned = false;
24336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24337 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
24341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24342 LDKUserConfig this_ptr_conv;
24343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24344 this_ptr_conv.is_owned = false;
24345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24346 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
24349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24350 LDKUserConfig this_ptr_conv;
24351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24352 this_ptr_conv.is_owned = false;
24353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24354 jboolean ret_val = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
24358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24359 LDKUserConfig this_ptr_conv;
24360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24361 this_ptr_conv.is_owned = false;
24362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24363 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
24366 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, jboolean manually_accept_inbound_channels_arg) {
24367 LDKChannelHandshakeConfig own_channel_config_arg_conv;
24368 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
24369 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
24370 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
24371 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
24372 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
24373 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
24374 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
24375 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
24376 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
24377 LDKChannelConfig channel_options_arg_conv;
24378 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
24379 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
24380 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
24381 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
24382 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, manually_accept_inbound_channels_arg);
24383 uintptr_t ret_ref = 0;
24384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24387 ret_ref = (uintptr_t)ret_var.inner;
24388 if (ret_var.is_owned) {
24394 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24395 LDKUserConfig ret_var = UserConfig_clone(arg);
24396 uintptr_t ret_ref = 0;
24397 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24398 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24400 ret_ref = (uintptr_t)ret_var.inner;
24401 if (ret_var.is_owned) {
24406 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24407 LDKUserConfig arg_conv;
24408 arg_conv.inner = (void*)(arg & (~1));
24409 arg_conv.is_owned = false;
24410 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24411 intptr_t ret_val = UserConfig_clone_ptr(&arg_conv);
24415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24416 LDKUserConfig orig_conv;
24417 orig_conv.inner = (void*)(orig & (~1));
24418 orig_conv.is_owned = false;
24419 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24420 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24421 uintptr_t ret_ref = 0;
24422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24425 ret_ref = (uintptr_t)ret_var.inner;
24426 if (ret_var.is_owned) {
24432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
24433 LDKUserConfig ret_var = UserConfig_default();
24434 uintptr_t ret_ref = 0;
24435 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24436 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24438 ret_ref = (uintptr_t)ret_var.inner;
24439 if (ret_var.is_owned) {
24445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24446 LDKBestBlock this_obj_conv;
24447 this_obj_conv.inner = (void*)(this_obj & (~1));
24448 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24450 BestBlock_free(this_obj_conv);
24453 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24454 LDKBestBlock ret_var = BestBlock_clone(arg);
24455 uintptr_t ret_ref = 0;
24456 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24457 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24459 ret_ref = (uintptr_t)ret_var.inner;
24460 if (ret_var.is_owned) {
24465 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24466 LDKBestBlock arg_conv;
24467 arg_conv.inner = (void*)(arg & (~1));
24468 arg_conv.is_owned = false;
24469 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24470 intptr_t ret_val = BestBlock_clone_ptr(&arg_conv);
24474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24475 LDKBestBlock orig_conv;
24476 orig_conv.inner = (void*)(orig & (~1));
24477 orig_conv.is_owned = false;
24478 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24479 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
24480 uintptr_t ret_ref = 0;
24481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24484 ret_ref = (uintptr_t)ret_var.inner;
24485 if (ret_var.is_owned) {
24491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
24492 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
24493 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
24494 uintptr_t ret_ref = 0;
24495 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24496 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24497 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24498 ret_ref = (uintptr_t)ret_var.inner;
24499 if (ret_var.is_owned) {
24505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
24506 LDKThirtyTwoBytes block_hash_ref;
24507 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
24508 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
24509 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
24510 uintptr_t ret_ref = 0;
24511 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24512 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24513 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24514 ret_ref = (uintptr_t)ret_var.inner;
24515 if (ret_var.is_owned) {
24521 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
24522 LDKBestBlock this_arg_conv;
24523 this_arg_conv.inner = (void*)(this_arg & (~1));
24524 this_arg_conv.is_owned = false;
24525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24526 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24527 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
24531 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
24532 LDKBestBlock this_arg_conv;
24533 this_arg_conv.inner = (void*)(this_arg & (~1));
24534 this_arg_conv.is_owned = false;
24535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24536 int32_t ret_val = BestBlock_height(&this_arg_conv);
24540 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24541 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
24542 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
24546 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
24547 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
24551 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
24552 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
24556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24557 if ((this_ptr & 1) != 0) return;
24558 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24559 CHECK_ACCESS(this_ptr_ptr);
24560 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
24561 FREE((void*)this_ptr);
24562 Access_free(this_ptr_conv);
24565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24566 if ((this_ptr & 1) != 0) return;
24567 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24568 CHECK_ACCESS(this_ptr_ptr);
24569 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
24570 FREE((void*)this_ptr);
24571 Listen_free(this_ptr_conv);
24574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24575 if ((this_ptr & 1) != 0) return;
24576 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24577 CHECK_ACCESS(this_ptr_ptr);
24578 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
24579 FREE((void*)this_ptr);
24580 Confirm_free(this_ptr_conv);
24583 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24584 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
24585 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
24589 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
24590 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
24594 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
24595 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
24599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24600 if ((this_ptr & 1) != 0) return;
24601 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24602 CHECK_ACCESS(this_ptr_ptr);
24603 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
24604 FREE((void*)this_ptr);
24605 Watch_free(this_ptr_conv);
24608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24609 if ((this_ptr & 1) != 0) return;
24610 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24611 CHECK_ACCESS(this_ptr_ptr);
24612 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
24613 FREE((void*)this_ptr);
24614 Filter_free(this_ptr_conv);
24617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24618 LDKWatchedOutput this_obj_conv;
24619 this_obj_conv.inner = (void*)(this_obj & (~1));
24620 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24622 WatchedOutput_free(this_obj_conv);
24625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
24626 LDKWatchedOutput this_ptr_conv;
24627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24628 this_ptr_conv.is_owned = false;
24629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24630 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24631 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
24635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24636 LDKWatchedOutput this_ptr_conv;
24637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24638 this_ptr_conv.is_owned = false;
24639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24640 LDKThirtyTwoBytes val_ref;
24641 CHECK((*env)->GetArrayLength(env, val) == 32);
24642 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24643 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
24646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24647 LDKWatchedOutput this_ptr_conv;
24648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24649 this_ptr_conv.is_owned = false;
24650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24651 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
24652 uintptr_t ret_ref = 0;
24653 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24654 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24656 ret_ref = (uintptr_t)ret_var.inner;
24657 if (ret_var.is_owned) {
24663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24664 LDKWatchedOutput this_ptr_conv;
24665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24666 this_ptr_conv.is_owned = false;
24667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24668 LDKOutPoint val_conv;
24669 val_conv.inner = (void*)(val & (~1));
24670 val_conv.is_owned = (val & 1) || (val == 0);
24671 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24672 val_conv = OutPoint_clone(&val_conv);
24673 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
24676 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24677 LDKWatchedOutput this_ptr_conv;
24678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24679 this_ptr_conv.is_owned = false;
24680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24681 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
24682 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24683 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24688 LDKWatchedOutput this_ptr_conv;
24689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24690 this_ptr_conv.is_owned = false;
24691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24692 LDKCVec_u8Z val_ref;
24693 val_ref.datalen = (*env)->GetArrayLength(env, val);
24694 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24695 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
24696 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
24699 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) {
24700 LDKThirtyTwoBytes block_hash_arg_ref;
24701 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
24702 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
24703 LDKOutPoint outpoint_arg_conv;
24704 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
24705 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
24706 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24707 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24708 LDKCVec_u8Z script_pubkey_arg_ref;
24709 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
24710 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24711 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
24712 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
24713 uintptr_t ret_ref = 0;
24714 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24715 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24717 ret_ref = (uintptr_t)ret_var.inner;
24718 if (ret_var.is_owned) {
24724 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
24725 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
24726 uintptr_t ret_ref = 0;
24727 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24728 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24729 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24730 ret_ref = (uintptr_t)ret_var.inner;
24731 if (ret_var.is_owned) {
24736 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24737 LDKWatchedOutput arg_conv;
24738 arg_conv.inner = (void*)(arg & (~1));
24739 arg_conv.is_owned = false;
24740 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24741 intptr_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
24745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24746 LDKWatchedOutput orig_conv;
24747 orig_conv.inner = (void*)(orig & (~1));
24748 orig_conv.is_owned = false;
24749 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24750 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
24751 uintptr_t ret_ref = 0;
24752 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24753 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24755 ret_ref = (uintptr_t)ret_var.inner;
24756 if (ret_var.is_owned) {
24762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
24763 LDKWatchedOutput o_conv;
24764 o_conv.inner = (void*)(o & (~1));
24765 o_conv.is_owned = false;
24766 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24767 int64_t ret_val = WatchedOutput_hash(&o_conv);
24771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24772 if ((this_ptr & 1) != 0) return;
24773 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24774 CHECK_ACCESS(this_ptr_ptr);
24775 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
24776 FREE((void*)this_ptr);
24777 BroadcasterInterface_free(this_ptr_conv);
24780 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24781 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
24782 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
24786 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
24787 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
24791 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
24792 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
24796 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
24797 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
24801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24802 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
24803 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
24804 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
24808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24809 if ((this_ptr & 1) != 0) return;
24810 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24811 CHECK_ACCESS(this_ptr_ptr);
24812 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
24813 FREE((void*)this_ptr);
24814 FeeEstimator_free(this_ptr_conv);
24817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24818 LDKMonitorUpdateId this_obj_conv;
24819 this_obj_conv.inner = (void*)(this_obj & (~1));
24820 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24822 MonitorUpdateId_free(this_obj_conv);
24825 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
24826 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
24827 uintptr_t ret_ref = 0;
24828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24831 ret_ref = (uintptr_t)ret_var.inner;
24832 if (ret_var.is_owned) {
24837 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24838 LDKMonitorUpdateId arg_conv;
24839 arg_conv.inner = (void*)(arg & (~1));
24840 arg_conv.is_owned = false;
24841 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24842 intptr_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
24846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24847 LDKMonitorUpdateId orig_conv;
24848 orig_conv.inner = (void*)(orig & (~1));
24849 orig_conv.is_owned = false;
24850 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24851 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
24852 uintptr_t ret_ref = 0;
24853 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24854 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24856 ret_ref = (uintptr_t)ret_var.inner;
24857 if (ret_var.is_owned) {
24863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
24864 LDKMonitorUpdateId o_conv;
24865 o_conv.inner = (void*)(o & (~1));
24866 o_conv.is_owned = false;
24867 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24868 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
24872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24873 LDKMonitorUpdateId a_conv;
24874 a_conv.inner = (void*)(a & (~1));
24875 a_conv.is_owned = false;
24876 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24877 LDKMonitorUpdateId b_conv;
24878 b_conv.inner = (void*)(b & (~1));
24879 b_conv.is_owned = false;
24880 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24881 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
24885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24886 if ((this_ptr & 1) != 0) return;
24887 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24888 CHECK_ACCESS(this_ptr_ptr);
24889 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
24890 FREE((void*)this_ptr);
24891 Persist_free(this_ptr_conv);
24894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24895 LDKLockedChannelMonitor this_obj_conv;
24896 this_obj_conv.inner = (void*)(this_obj & (~1));
24897 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24899 LockedChannelMonitor_free(this_obj_conv);
24902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24903 LDKChainMonitor this_obj_conv;
24904 this_obj_conv.inner = (void*)(this_obj & (~1));
24905 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24907 ChainMonitor_free(this_obj_conv);
24910 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) {
24911 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
24912 CHECK_ACCESS(chain_source_ptr);
24913 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
24914 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
24915 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
24916 // Manually implement clone for Java trait instances
24917 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
24918 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24919 LDKFilter_JCalls_cloned(&chain_source_conv.some);
24922 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24923 CHECK_ACCESS(broadcaster_ptr);
24924 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24925 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24926 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24927 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24929 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24930 CHECK_ACCESS(logger_ptr);
24931 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24932 if (logger_conv.free == LDKLogger_JCalls_free) {
24933 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24934 LDKLogger_JCalls_cloned(&logger_conv);
24936 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
24937 CHECK_ACCESS(feeest_ptr);
24938 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
24939 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
24940 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24941 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
24943 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
24944 CHECK_ACCESS(persister_ptr);
24945 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
24946 if (persister_conv.free == LDKPersist_JCalls_free) {
24947 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24948 LDKPersist_JCalls_cloned(&persister_conv);
24950 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
24951 uintptr_t ret_ref = 0;
24952 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24953 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24955 ret_ref = (uintptr_t)ret_var.inner;
24956 if (ret_var.is_owned) {
24962 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) {
24963 LDKChainMonitor this_arg_conv;
24964 this_arg_conv.inner = (void*)(this_arg & (~1));
24965 this_arg_conv.is_owned = false;
24966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24967 LDKCVec_ChannelDetailsZ ignored_channels_constr;
24968 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
24969 if (ignored_channels_constr.datalen > 0)
24970 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24972 ignored_channels_constr.data = NULL;
24973 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
24974 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
24975 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
24976 LDKChannelDetails ignored_channels_conv_16_conv;
24977 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
24978 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
24979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
24980 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
24981 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
24983 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
24984 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
24985 int64_tArray ret_arr = NULL;
24986 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24987 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24988 for (size_t j = 0; j < ret_var.datalen; j++) {
24989 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24990 *ret_conv_9_copy = ret_var.data[j];
24991 uintptr_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
24992 ret_arr_ptr[j] = ret_conv_9_ref;
24994 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24995 FREE(ret_var.data);
24999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
25000 LDKChainMonitor this_arg_conv;
25001 this_arg_conv.inner = (void*)(this_arg & (~1));
25002 this_arg_conv.is_owned = false;
25003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25004 LDKOutPoint funding_txo_conv;
25005 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25006 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25007 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25008 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25009 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
25010 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
25011 return (uintptr_t)ret_conv;
25014 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
25015 LDKChainMonitor this_arg_conv;
25016 this_arg_conv.inner = (void*)(this_arg & (~1));
25017 this_arg_conv.is_owned = false;
25018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25019 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
25020 int64_tArray ret_arr = NULL;
25021 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25022 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25023 for (size_t k = 0; k < ret_var.datalen; k++) {
25024 LDKOutPoint ret_conv_10_var = ret_var.data[k];
25025 uintptr_t ret_conv_10_ref = 0;
25026 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25027 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
25029 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
25030 if (ret_conv_10_var.is_owned) {
25031 ret_conv_10_ref |= 1;
25033 ret_arr_ptr[k] = ret_conv_10_ref;
25035 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25036 FREE(ret_var.data);
25040 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) {
25041 LDKChainMonitor this_arg_conv;
25042 this_arg_conv.inner = (void*)(this_arg & (~1));
25043 this_arg_conv.is_owned = false;
25044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25045 LDKOutPoint funding_txo_conv;
25046 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25047 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25048 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25049 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25050 LDKMonitorUpdateId completed_update_id_conv;
25051 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
25052 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
25053 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
25054 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
25055 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25056 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
25057 return (uintptr_t)ret_conv;
25060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
25061 LDKChainMonitor this_arg_conv;
25062 this_arg_conv.inner = (void*)(this_arg & (~1));
25063 this_arg_conv.is_owned = false;
25064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25065 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
25066 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
25067 return (uintptr_t)ret_ret;
25070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
25071 LDKChainMonitor this_arg_conv;
25072 this_arg_conv.inner = (void*)(this_arg & (~1));
25073 this_arg_conv.is_owned = false;
25074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25075 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
25076 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
25077 return (uintptr_t)ret_ret;
25080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
25081 LDKChainMonitor this_arg_conv;
25082 this_arg_conv.inner = (void*)(this_arg & (~1));
25083 this_arg_conv.is_owned = false;
25084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25085 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
25086 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
25087 return (uintptr_t)ret_ret;
25090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25091 LDKChainMonitor this_arg_conv;
25092 this_arg_conv.inner = (void*)(this_arg & (~1));
25093 this_arg_conv.is_owned = false;
25094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25095 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
25096 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
25097 return (uintptr_t)ret_ret;
25100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25101 LDKChannelMonitorUpdate this_obj_conv;
25102 this_obj_conv.inner = (void*)(this_obj & (~1));
25103 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25105 ChannelMonitorUpdate_free(this_obj_conv);
25108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
25109 LDKChannelMonitorUpdate this_ptr_conv;
25110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25111 this_ptr_conv.is_owned = false;
25112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25113 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
25117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25118 LDKChannelMonitorUpdate this_ptr_conv;
25119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25120 this_ptr_conv.is_owned = false;
25121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25122 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
25125 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
25126 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
25127 uintptr_t ret_ref = 0;
25128 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25129 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25131 ret_ref = (uintptr_t)ret_var.inner;
25132 if (ret_var.is_owned) {
25137 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25138 LDKChannelMonitorUpdate arg_conv;
25139 arg_conv.inner = (void*)(arg & (~1));
25140 arg_conv.is_owned = false;
25141 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25142 intptr_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
25146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25147 LDKChannelMonitorUpdate orig_conv;
25148 orig_conv.inner = (void*)(orig & (~1));
25149 orig_conv.is_owned = false;
25150 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25151 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
25152 uintptr_t ret_ref = 0;
25153 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25154 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25156 ret_ref = (uintptr_t)ret_var.inner;
25157 if (ret_var.is_owned) {
25163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25164 LDKChannelMonitorUpdate obj_conv;
25165 obj_conv.inner = (void*)(obj & (~1));
25166 obj_conv.is_owned = false;
25167 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25168 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25169 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25170 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25171 CVec_u8Z_free(ret_var);
25175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25176 LDKu8slice ser_ref;
25177 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25178 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25179 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25180 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25181 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25182 return (uintptr_t)ret_conv;
25185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25186 if ((this_ptr & 1) != 0) return;
25187 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25188 CHECK_ACCESS(this_ptr_ptr);
25189 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25190 FREE((void*)this_ptr);
25191 MonitorEvent_free(this_ptr_conv);
25194 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25195 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25196 *ret_copy = MonitorEvent_clone(arg);
25197 uintptr_t ret_ref = (uintptr_t)ret_copy;
25200 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25201 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
25202 intptr_t ret_val = MonitorEvent_clone_ptr(arg_conv);
25206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25207 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
25208 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25209 *ret_copy = MonitorEvent_clone(orig_conv);
25210 uintptr_t ret_ref = (uintptr_t)ret_copy;
25214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
25215 LDKHTLCUpdate a_conv;
25216 a_conv.inner = (void*)(a & (~1));
25217 a_conv.is_owned = (a & 1) || (a == 0);
25218 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25219 a_conv = HTLCUpdate_clone(&a_conv);
25220 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25221 *ret_copy = MonitorEvent_htlcevent(a_conv);
25222 uintptr_t ret_ref = (uintptr_t)ret_copy;
25226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
25227 LDKOutPoint a_conv;
25228 a_conv.inner = (void*)(a & (~1));
25229 a_conv.is_owned = (a & 1) || (a == 0);
25230 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25231 a_conv = OutPoint_clone(&a_conv);
25232 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25233 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25234 uintptr_t ret_ref = (uintptr_t)ret_copy;
25238 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) {
25239 LDKOutPoint funding_txo_conv;
25240 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25241 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25242 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25243 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25244 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25245 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
25246 uintptr_t ret_ref = (uintptr_t)ret_copy;
25250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
25251 LDKOutPoint a_conv;
25252 a_conv.inner = (void*)(a & (~1));
25253 a_conv.is_owned = (a & 1) || (a == 0);
25254 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25255 a_conv = OutPoint_clone(&a_conv);
25256 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25257 *ret_copy = MonitorEvent_update_failed(a_conv);
25258 uintptr_t ret_ref = (uintptr_t)ret_copy;
25262 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
25263 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
25264 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
25265 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25266 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25267 CVec_u8Z_free(ret_var);
25271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25272 LDKu8slice ser_ref;
25273 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25274 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25275 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25276 *ret_conv = MonitorEvent_read(ser_ref);
25277 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25278 return (uintptr_t)ret_conv;
25281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25282 LDKHTLCUpdate this_obj_conv;
25283 this_obj_conv.inner = (void*)(this_obj & (~1));
25284 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25286 HTLCUpdate_free(this_obj_conv);
25289 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
25290 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
25291 uintptr_t ret_ref = 0;
25292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25295 ret_ref = (uintptr_t)ret_var.inner;
25296 if (ret_var.is_owned) {
25301 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25302 LDKHTLCUpdate arg_conv;
25303 arg_conv.inner = (void*)(arg & (~1));
25304 arg_conv.is_owned = false;
25305 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25306 intptr_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
25310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25311 LDKHTLCUpdate orig_conv;
25312 orig_conv.inner = (void*)(orig & (~1));
25313 orig_conv.is_owned = false;
25314 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25315 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
25316 uintptr_t ret_ref = 0;
25317 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25318 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25319 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25320 ret_ref = (uintptr_t)ret_var.inner;
25321 if (ret_var.is_owned) {
25327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25328 LDKHTLCUpdate obj_conv;
25329 obj_conv.inner = (void*)(obj & (~1));
25330 obj_conv.is_owned = false;
25331 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25332 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25333 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25334 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25335 CVec_u8Z_free(ret_var);
25339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25340 LDKu8slice ser_ref;
25341 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25342 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25343 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25344 *ret_conv = HTLCUpdate_read(ser_ref);
25345 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25346 return (uintptr_t)ret_conv;
25349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25350 if ((this_ptr & 1) != 0) return;
25351 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25352 CHECK_ACCESS(this_ptr_ptr);
25353 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25354 FREE((void*)this_ptr);
25355 Balance_free(this_ptr_conv);
25358 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25359 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25360 *ret_copy = Balance_clone(arg);
25361 uintptr_t ret_ref = (uintptr_t)ret_copy;
25364 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25365 LDKBalance* arg_conv = (LDKBalance*)arg;
25366 intptr_t ret_val = Balance_clone_ptr(arg_conv);
25370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25371 LDKBalance* orig_conv = (LDKBalance*)orig;
25372 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25373 *ret_copy = Balance_clone(orig_conv);
25374 uintptr_t ret_ref = (uintptr_t)ret_copy;
25378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
25379 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25380 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25381 uintptr_t ret_ref = (uintptr_t)ret_copy;
25385 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) {
25386 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25387 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25388 uintptr_t ret_ref = (uintptr_t)ret_copy;
25392 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) {
25393 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25394 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25395 uintptr_t ret_ref = (uintptr_t)ret_copy;
25399 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) {
25400 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25401 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
25402 uintptr_t ret_ref = (uintptr_t)ret_copy;
25406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25407 LDKBalance* a_conv = (LDKBalance*)a;
25408 LDKBalance* b_conv = (LDKBalance*)b;
25409 jboolean ret_val = Balance_eq(a_conv, b_conv);
25413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25414 LDKChannelMonitor this_obj_conv;
25415 this_obj_conv.inner = (void*)(this_obj & (~1));
25416 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25418 ChannelMonitor_free(this_obj_conv);
25421 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25422 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25423 uintptr_t ret_ref = 0;
25424 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25425 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25426 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25427 ret_ref = (uintptr_t)ret_var.inner;
25428 if (ret_var.is_owned) {
25433 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25434 LDKChannelMonitor arg_conv;
25435 arg_conv.inner = (void*)(arg & (~1));
25436 arg_conv.is_owned = false;
25437 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25438 intptr_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
25442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25443 LDKChannelMonitor orig_conv;
25444 orig_conv.inner = (void*)(orig & (~1));
25445 orig_conv.is_owned = false;
25446 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25447 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25448 uintptr_t ret_ref = 0;
25449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25452 ret_ref = (uintptr_t)ret_var.inner;
25453 if (ret_var.is_owned) {
25459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
25460 LDKChannelMonitor obj_conv;
25461 obj_conv.inner = (void*)(obj & (~1));
25462 obj_conv.is_owned = false;
25463 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25464 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25465 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25466 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25467 CVec_u8Z_free(ret_var);
25471 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) {
25472 LDKChannelMonitor this_arg_conv;
25473 this_arg_conv.inner = (void*)(this_arg & (~1));
25474 this_arg_conv.is_owned = false;
25475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25476 LDKChannelMonitorUpdate updates_conv;
25477 updates_conv.inner = (void*)(updates & (~1));
25478 updates_conv.is_owned = false;
25479 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25480 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25481 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
25482 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
25483 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25484 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
25485 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
25486 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25487 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
25488 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25489 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25490 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25491 return (uintptr_t)ret_conv;
25494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
25495 LDKChannelMonitor this_arg_conv;
25496 this_arg_conv.inner = (void*)(this_arg & (~1));
25497 this_arg_conv.is_owned = false;
25498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25499 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
25503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
25504 LDKChannelMonitor this_arg_conv;
25505 this_arg_conv.inner = (void*)(this_arg & (~1));
25506 this_arg_conv.is_owned = false;
25507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25508 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25509 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
25510 return ((uintptr_t)ret_conv);
25513 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
25514 LDKChannelMonitor this_arg_conv;
25515 this_arg_conv.inner = (void*)(this_arg & (~1));
25516 this_arg_conv.is_owned = false;
25517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25518 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
25519 int64_tArray ret_arr = NULL;
25520 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25521 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25522 for (size_t o = 0; o < ret_var.datalen; o++) {
25523 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25524 *ret_conv_40_conv = ret_var.data[o];
25525 ret_arr_ptr[o] = ((uintptr_t)ret_conv_40_conv);
25527 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25528 FREE(ret_var.data);
25532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
25533 LDKChannelMonitor this_arg_conv;
25534 this_arg_conv.inner = (void*)(this_arg & (~1));
25535 this_arg_conv.is_owned = false;
25536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25537 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
25538 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
25539 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
25540 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
25543 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
25544 LDKChannelMonitor this_arg_conv;
25545 this_arg_conv.inner = (void*)(this_arg & (~1));
25546 this_arg_conv.is_owned = false;
25547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25548 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
25549 int64_tArray ret_arr = NULL;
25550 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25551 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25552 for (size_t o = 0; o < ret_var.datalen; o++) {
25553 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25554 *ret_conv_14_copy = ret_var.data[o];
25555 uintptr_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
25556 ret_arr_ptr[o] = ret_conv_14_ref;
25558 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25559 FREE(ret_var.data);
25563 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
25564 LDKChannelMonitor this_arg_conv;
25565 this_arg_conv.inner = (void*)(this_arg & (~1));
25566 this_arg_conv.is_owned = false;
25567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25568 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
25569 int64_tArray ret_arr = NULL;
25570 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25571 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25572 for (size_t h = 0; h < ret_var.datalen; h++) {
25573 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25574 *ret_conv_7_copy = ret_var.data[h];
25575 uintptr_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
25576 ret_arr_ptr[h] = ret_conv_7_ref;
25578 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25579 FREE(ret_var.data);
25583 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) {
25584 LDKChannelMonitor this_arg_conv;
25585 this_arg_conv.inner = (void*)(this_arg & (~1));
25586 this_arg_conv.is_owned = false;
25587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25588 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25589 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
25590 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25591 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
25592 jobjectArray ret_arr = NULL;
25593 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
25595 for (size_t i = 0; i < ret_var.datalen; i++) {
25596 LDKTransaction ret_conv_8_var = ret_var.data[i];
25597 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
25598 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
25599 Transaction_free(ret_conv_8_var);
25600 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
25603 FREE(ret_var.data);
25607 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) {
25608 LDKChannelMonitor this_arg_conv;
25609 this_arg_conv.inner = (void*)(this_arg & (~1));
25610 this_arg_conv.is_owned = false;
25611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25612 unsigned char header_arr[80];
25613 CHECK((*env)->GetArrayLength(env, header) == 80);
25614 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
25615 unsigned char (*header_ref)[80] = &header_arr;
25616 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25617 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
25618 if (txdata_constr.datalen > 0)
25619 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25621 txdata_constr.data = NULL;
25622 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
25623 for (size_t c = 0; c < txdata_constr.datalen; c++) {
25624 int64_t txdata_conv_28 = txdata_vals[c];
25625 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
25626 CHECK_ACCESS(txdata_conv_28_ptr);
25627 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25628 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
25629 txdata_constr.data[c] = txdata_conv_28_conv;
25631 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
25632 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25633 CHECK_ACCESS(broadcaster_ptr);
25634 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25635 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25636 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25637 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25639 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25640 CHECK_ACCESS(fee_estimator_ptr);
25641 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25642 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25643 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25644 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25646 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25647 CHECK_ACCESS(logger_ptr);
25648 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25649 if (logger_conv.free == LDKLogger_JCalls_free) {
25650 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25651 LDKLogger_JCalls_cloned(&logger_conv);
25653 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);
25654 int64_tArray ret_arr = NULL;
25655 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25656 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25657 for (size_t n = 0; n < ret_var.datalen; n++) {
25658 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25659 *ret_conv_39_conv = ret_var.data[n];
25660 ret_arr_ptr[n] = ((uintptr_t)ret_conv_39_conv);
25662 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25663 FREE(ret_var.data);
25667 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) {
25668 LDKChannelMonitor this_arg_conv;
25669 this_arg_conv.inner = (void*)(this_arg & (~1));
25670 this_arg_conv.is_owned = false;
25671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25672 unsigned char header_arr[80];
25673 CHECK((*env)->GetArrayLength(env, header) == 80);
25674 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
25675 unsigned char (*header_ref)[80] = &header_arr;
25676 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25677 CHECK_ACCESS(broadcaster_ptr);
25678 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25679 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25680 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25681 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25683 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25684 CHECK_ACCESS(fee_estimator_ptr);
25685 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25686 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25687 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25688 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25690 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25691 CHECK_ACCESS(logger_ptr);
25692 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25693 if (logger_conv.free == LDKLogger_JCalls_free) {
25694 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25695 LDKLogger_JCalls_cloned(&logger_conv);
25697 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25700 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) {
25701 LDKChannelMonitor this_arg_conv;
25702 this_arg_conv.inner = (void*)(this_arg & (~1));
25703 this_arg_conv.is_owned = false;
25704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25705 unsigned char header_arr[80];
25706 CHECK((*env)->GetArrayLength(env, header) == 80);
25707 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
25708 unsigned char (*header_ref)[80] = &header_arr;
25709 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25710 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
25711 if (txdata_constr.datalen > 0)
25712 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25714 txdata_constr.data = NULL;
25715 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
25716 for (size_t c = 0; c < txdata_constr.datalen; c++) {
25717 int64_t txdata_conv_28 = txdata_vals[c];
25718 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
25719 CHECK_ACCESS(txdata_conv_28_ptr);
25720 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25721 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
25722 txdata_constr.data[c] = txdata_conv_28_conv;
25724 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
25725 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25726 CHECK_ACCESS(broadcaster_ptr);
25727 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25728 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25729 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25730 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25732 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25733 CHECK_ACCESS(fee_estimator_ptr);
25734 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25735 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25736 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25737 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25739 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25740 CHECK_ACCESS(logger_ptr);
25741 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25742 if (logger_conv.free == LDKLogger_JCalls_free) {
25743 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25744 LDKLogger_JCalls_cloned(&logger_conv);
25746 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);
25747 int64_tArray ret_arr = NULL;
25748 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25749 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25750 for (size_t n = 0; n < ret_var.datalen; n++) {
25751 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25752 *ret_conv_39_conv = ret_var.data[n];
25753 ret_arr_ptr[n] = ((uintptr_t)ret_conv_39_conv);
25755 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25756 FREE(ret_var.data);
25760 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) {
25761 LDKChannelMonitor this_arg_conv;
25762 this_arg_conv.inner = (void*)(this_arg & (~1));
25763 this_arg_conv.is_owned = false;
25764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25765 unsigned char txid_arr[32];
25766 CHECK((*env)->GetArrayLength(env, txid) == 32);
25767 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
25768 unsigned char (*txid_ref)[32] = &txid_arr;
25769 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25770 CHECK_ACCESS(broadcaster_ptr);
25771 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25772 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25773 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25774 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25776 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25777 CHECK_ACCESS(fee_estimator_ptr);
25778 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25779 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25780 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25781 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25783 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25784 CHECK_ACCESS(logger_ptr);
25785 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25786 if (logger_conv.free == LDKLogger_JCalls_free) {
25787 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25788 LDKLogger_JCalls_cloned(&logger_conv);
25790 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
25793 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) {
25794 LDKChannelMonitor this_arg_conv;
25795 this_arg_conv.inner = (void*)(this_arg & (~1));
25796 this_arg_conv.is_owned = false;
25797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25798 unsigned char header_arr[80];
25799 CHECK((*env)->GetArrayLength(env, header) == 80);
25800 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
25801 unsigned char (*header_ref)[80] = &header_arr;
25802 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25803 CHECK_ACCESS(broadcaster_ptr);
25804 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25805 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25806 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25807 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25809 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25810 CHECK_ACCESS(fee_estimator_ptr);
25811 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25812 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25813 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25814 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25816 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25817 CHECK_ACCESS(logger_ptr);
25818 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25819 if (logger_conv.free == LDKLogger_JCalls_free) {
25820 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25821 LDKLogger_JCalls_cloned(&logger_conv);
25823 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25824 int64_tArray ret_arr = NULL;
25825 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25826 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25827 for (size_t n = 0; n < ret_var.datalen; n++) {
25828 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25829 *ret_conv_39_conv = ret_var.data[n];
25830 ret_arr_ptr[n] = ((uintptr_t)ret_conv_39_conv);
25832 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25833 FREE(ret_var.data);
25837 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
25838 LDKChannelMonitor this_arg_conv;
25839 this_arg_conv.inner = (void*)(this_arg & (~1));
25840 this_arg_conv.is_owned = false;
25841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25842 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
25843 jobjectArray ret_arr = NULL;
25844 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
25846 for (size_t i = 0; i < ret_var.datalen; i++) {
25847 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
25848 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
25849 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
25852 FREE(ret_var.data);
25856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
25857 LDKChannelMonitor this_arg_conv;
25858 this_arg_conv.inner = (void*)(this_arg & (~1));
25859 this_arg_conv.is_owned = false;
25860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25861 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
25862 uintptr_t ret_ref = 0;
25863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25866 ret_ref = (uintptr_t)ret_var.inner;
25867 if (ret_var.is_owned) {
25873 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
25874 LDKChannelMonitor this_arg_conv;
25875 this_arg_conv.inner = (void*)(this_arg & (~1));
25876 this_arg_conv.is_owned = false;
25877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25878 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
25879 int64_tArray ret_arr = NULL;
25880 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25881 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25882 for (size_t j = 0; j < ret_var.datalen; j++) {
25883 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25884 *ret_conv_9_copy = ret_var.data[j];
25885 uintptr_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
25886 ret_arr_ptr[j] = ret_conv_9_ref;
25888 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25889 FREE(ret_var.data);
25893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
25894 LDKu8slice ser_ref;
25895 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25896 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25897 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
25898 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
25899 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
25900 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25901 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
25902 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25903 return (uintptr_t)ret_conv;
25906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25907 LDKOutPoint this_obj_conv;
25908 this_obj_conv.inner = (void*)(this_obj & (~1));
25909 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25911 OutPoint_free(this_obj_conv);
25914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
25915 LDKOutPoint this_ptr_conv;
25916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25917 this_ptr_conv.is_owned = false;
25918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25919 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25920 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
25924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25925 LDKOutPoint this_ptr_conv;
25926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25927 this_ptr_conv.is_owned = false;
25928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25929 LDKThirtyTwoBytes val_ref;
25930 CHECK((*env)->GetArrayLength(env, val) == 32);
25931 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25932 OutPoint_set_txid(&this_ptr_conv, val_ref);
25935 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
25936 LDKOutPoint this_ptr_conv;
25937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25938 this_ptr_conv.is_owned = false;
25939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25940 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
25944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25945 LDKOutPoint this_ptr_conv;
25946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25947 this_ptr_conv.is_owned = false;
25948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25949 OutPoint_set_index(&this_ptr_conv, val);
25952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
25953 LDKThirtyTwoBytes txid_arg_ref;
25954 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
25955 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
25956 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
25957 uintptr_t ret_ref = 0;
25958 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25959 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25960 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25961 ret_ref = (uintptr_t)ret_var.inner;
25962 if (ret_var.is_owned) {
25968 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
25969 LDKOutPoint ret_var = OutPoint_clone(arg);
25970 uintptr_t ret_ref = 0;
25971 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25972 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25974 ret_ref = (uintptr_t)ret_var.inner;
25975 if (ret_var.is_owned) {
25980 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25981 LDKOutPoint arg_conv;
25982 arg_conv.inner = (void*)(arg & (~1));
25983 arg_conv.is_owned = false;
25984 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25985 intptr_t ret_val = OutPoint_clone_ptr(&arg_conv);
25989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25990 LDKOutPoint orig_conv;
25991 orig_conv.inner = (void*)(orig & (~1));
25992 orig_conv.is_owned = false;
25993 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25994 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
25995 uintptr_t ret_ref = 0;
25996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25999 ret_ref = (uintptr_t)ret_var.inner;
26000 if (ret_var.is_owned) {
26006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26007 LDKOutPoint a_conv;
26008 a_conv.inner = (void*)(a & (~1));
26009 a_conv.is_owned = false;
26010 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26011 LDKOutPoint b_conv;
26012 b_conv.inner = (void*)(b & (~1));
26013 b_conv.is_owned = false;
26014 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26015 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
26019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
26020 LDKOutPoint o_conv;
26021 o_conv.inner = (void*)(o & (~1));
26022 o_conv.is_owned = false;
26023 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26024 int64_t ret_val = OutPoint_hash(&o_conv);
26028 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26029 LDKOutPoint this_arg_conv;
26030 this_arg_conv.inner = (void*)(this_arg & (~1));
26031 this_arg_conv.is_owned = false;
26032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26033 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26034 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
26038 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
26039 LDKOutPoint obj_conv;
26040 obj_conv.inner = (void*)(obj & (~1));
26041 obj_conv.is_owned = false;
26042 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26043 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
26044 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26045 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26046 CVec_u8Z_free(ret_var);
26050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26051 LDKu8slice ser_ref;
26052 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26053 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26054 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
26055 *ret_conv = OutPoint_read(ser_ref);
26056 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26057 return (uintptr_t)ret_conv;
26060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26061 LDKDelayedPaymentOutputDescriptor this_obj_conv;
26062 this_obj_conv.inner = (void*)(this_obj & (~1));
26063 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26065 DelayedPaymentOutputDescriptor_free(this_obj_conv);
26068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26069 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26071 this_ptr_conv.is_owned = false;
26072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26073 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26074 uintptr_t ret_ref = 0;
26075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26078 ret_ref = (uintptr_t)ret_var.inner;
26079 if (ret_var.is_owned) {
26085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26086 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26088 this_ptr_conv.is_owned = false;
26089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26090 LDKOutPoint val_conv;
26091 val_conv.inner = (void*)(val & (~1));
26092 val_conv.is_owned = (val & 1) || (val == 0);
26093 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26094 val_conv = OutPoint_clone(&val_conv);
26095 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
26099 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26101 this_ptr_conv.is_owned = false;
26102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26103 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26104 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
26108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26109 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26111 this_ptr_conv.is_owned = false;
26112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26113 LDKPublicKey val_ref;
26114 CHECK((*env)->GetArrayLength(env, val) == 33);
26115 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26116 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26119 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26120 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26122 this_ptr_conv.is_owned = false;
26123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26124 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26129 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26131 this_ptr_conv.is_owned = false;
26132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26133 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26137 LDKDelayedPaymentOutputDescriptor 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 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26142 CHECK_ACCESS(val_ptr);
26143 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26144 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
26145 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26149 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26151 this_ptr_conv.is_owned = false;
26152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26153 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26154 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
26158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26159 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26161 this_ptr_conv.is_owned = false;
26162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26163 LDKPublicKey val_ref;
26164 CHECK((*env)->GetArrayLength(env, val) == 33);
26165 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26166 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26170 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26172 this_ptr_conv.is_owned = false;
26173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26174 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26175 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
26179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26180 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26182 this_ptr_conv.is_owned = false;
26183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26184 LDKThirtyTwoBytes val_ref;
26185 CHECK((*env)->GetArrayLength(env, val) == 32);
26186 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26187 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26191 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26193 this_ptr_conv.is_owned = false;
26194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26195 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26200 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26202 this_ptr_conv.is_owned = false;
26203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26204 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26207 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) {
26208 LDKOutPoint outpoint_arg_conv;
26209 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26210 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26211 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26212 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26213 LDKPublicKey per_commitment_point_arg_ref;
26214 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
26215 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
26216 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
26217 CHECK_ACCESS(output_arg_ptr);
26218 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26219 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
26220 LDKPublicKey revocation_pubkey_arg_ref;
26221 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
26222 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
26223 LDKThirtyTwoBytes channel_keys_id_arg_ref;
26224 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
26225 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
26226 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);
26227 uintptr_t ret_ref = 0;
26228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26231 ret_ref = (uintptr_t)ret_var.inner;
26232 if (ret_var.is_owned) {
26238 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26239 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26240 uintptr_t ret_ref = 0;
26241 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26242 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26244 ret_ref = (uintptr_t)ret_var.inner;
26245 if (ret_var.is_owned) {
26250 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26251 LDKDelayedPaymentOutputDescriptor arg_conv;
26252 arg_conv.inner = (void*)(arg & (~1));
26253 arg_conv.is_owned = false;
26254 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26255 intptr_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
26259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26260 LDKDelayedPaymentOutputDescriptor orig_conv;
26261 orig_conv.inner = (void*)(orig & (~1));
26262 orig_conv.is_owned = false;
26263 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26264 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
26265 uintptr_t ret_ref = 0;
26266 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26267 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26269 ret_ref = (uintptr_t)ret_var.inner;
26270 if (ret_var.is_owned) {
26276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26277 LDKDelayedPaymentOutputDescriptor obj_conv;
26278 obj_conv.inner = (void*)(obj & (~1));
26279 obj_conv.is_owned = false;
26280 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26281 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26282 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26283 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26284 CVec_u8Z_free(ret_var);
26288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26289 LDKu8slice ser_ref;
26290 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26291 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26292 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26293 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26294 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26295 return (uintptr_t)ret_conv;
26298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26299 LDKStaticPaymentOutputDescriptor this_obj_conv;
26300 this_obj_conv.inner = (void*)(this_obj & (~1));
26301 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26303 StaticPaymentOutputDescriptor_free(this_obj_conv);
26306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26307 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26309 this_ptr_conv.is_owned = false;
26310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26311 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26312 uintptr_t ret_ref = 0;
26313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26316 ret_ref = (uintptr_t)ret_var.inner;
26317 if (ret_var.is_owned) {
26323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26324 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26326 this_ptr_conv.is_owned = false;
26327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26328 LDKOutPoint val_conv;
26329 val_conv.inner = (void*)(val & (~1));
26330 val_conv.is_owned = (val & 1) || (val == 0);
26331 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26332 val_conv = OutPoint_clone(&val_conv);
26333 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26337 LDKStaticPaymentOutputDescriptor 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 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26342 CHECK_ACCESS(val_ptr);
26343 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26344 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
26345 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26348 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26349 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26351 this_ptr_conv.is_owned = false;
26352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26353 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26354 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
26358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26359 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26361 this_ptr_conv.is_owned = false;
26362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26363 LDKThirtyTwoBytes val_ref;
26364 CHECK((*env)->GetArrayLength(env, val) == 32);
26365 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26366 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26370 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26372 this_ptr_conv.is_owned = false;
26373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26374 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26379 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26381 this_ptr_conv.is_owned = false;
26382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26383 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26386 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) {
26387 LDKOutPoint outpoint_arg_conv;
26388 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26389 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26390 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26391 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26392 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
26393 CHECK_ACCESS(output_arg_ptr);
26394 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26395 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
26396 LDKThirtyTwoBytes channel_keys_id_arg_ref;
26397 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
26398 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
26399 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26400 uintptr_t ret_ref = 0;
26401 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26402 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26403 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26404 ret_ref = (uintptr_t)ret_var.inner;
26405 if (ret_var.is_owned) {
26411 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26412 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26413 uintptr_t ret_ref = 0;
26414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26417 ret_ref = (uintptr_t)ret_var.inner;
26418 if (ret_var.is_owned) {
26423 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26424 LDKStaticPaymentOutputDescriptor arg_conv;
26425 arg_conv.inner = (void*)(arg & (~1));
26426 arg_conv.is_owned = false;
26427 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26428 intptr_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26433 LDKStaticPaymentOutputDescriptor orig_conv;
26434 orig_conv.inner = (void*)(orig & (~1));
26435 orig_conv.is_owned = false;
26436 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26437 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26438 uintptr_t ret_ref = 0;
26439 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26440 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26442 ret_ref = (uintptr_t)ret_var.inner;
26443 if (ret_var.is_owned) {
26449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26450 LDKStaticPaymentOutputDescriptor obj_conv;
26451 obj_conv.inner = (void*)(obj & (~1));
26452 obj_conv.is_owned = false;
26453 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26454 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26455 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26456 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26457 CVec_u8Z_free(ret_var);
26461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26462 LDKu8slice ser_ref;
26463 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26464 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26465 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26466 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26467 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26468 return (uintptr_t)ret_conv;
26471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26472 if ((this_ptr & 1) != 0) return;
26473 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26474 CHECK_ACCESS(this_ptr_ptr);
26475 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26476 FREE((void*)this_ptr);
26477 SpendableOutputDescriptor_free(this_ptr_conv);
26480 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
26481 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26482 *ret_copy = SpendableOutputDescriptor_clone(arg);
26483 uintptr_t ret_ref = (uintptr_t)ret_copy;
26486 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26487 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
26488 intptr_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
26492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26493 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
26494 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26495 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
26496 uintptr_t ret_ref = (uintptr_t)ret_copy;
26500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
26501 LDKOutPoint outpoint_conv;
26502 outpoint_conv.inner = (void*)(outpoint & (~1));
26503 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
26504 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
26505 outpoint_conv = OutPoint_clone(&outpoint_conv);
26506 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
26507 CHECK_ACCESS(output_ptr);
26508 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
26509 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
26510 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26511 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
26512 uintptr_t ret_ref = (uintptr_t)ret_copy;
26516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
26517 LDKDelayedPaymentOutputDescriptor a_conv;
26518 a_conv.inner = (void*)(a & (~1));
26519 a_conv.is_owned = (a & 1) || (a == 0);
26520 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26521 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
26522 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26523 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
26524 uintptr_t ret_ref = (uintptr_t)ret_copy;
26528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
26529 LDKStaticPaymentOutputDescriptor a_conv;
26530 a_conv.inner = (void*)(a & (~1));
26531 a_conv.is_owned = (a & 1) || (a == 0);
26532 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26533 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
26534 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26535 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
26536 uintptr_t ret_ref = (uintptr_t)ret_copy;
26540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26541 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
26542 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
26543 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26544 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26545 CVec_u8Z_free(ret_var);
26549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26550 LDKu8slice ser_ref;
26551 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26552 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26553 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
26554 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
26555 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26556 return (uintptr_t)ret_conv;
26559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26560 if ((this_ptr & 1) != 0) return;
26561 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26562 CHECK_ACCESS(this_ptr_ptr);
26563 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
26564 FREE((void*)this_ptr);
26565 BaseSign_free(this_ptr_conv);
26568 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
26569 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26570 *ret_ret = Sign_clone(arg);
26571 return (uintptr_t)ret_ret;
26573 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26574 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
26575 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
26576 LDKSign* arg_conv = (LDKSign*)arg_ptr;
26577 intptr_t ret_val = Sign_clone_ptr(arg_conv);
26581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26582 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
26583 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
26584 LDKSign* orig_conv = (LDKSign*)orig_ptr;
26585 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26586 *ret_ret = Sign_clone(orig_conv);
26587 return (uintptr_t)ret_ret;
26590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26591 if ((this_ptr & 1) != 0) return;
26592 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26593 CHECK_ACCESS(this_ptr_ptr);
26594 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
26595 FREE((void*)this_ptr);
26596 Sign_free(this_ptr_conv);
26599 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26600 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
26601 jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
26605 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
26606 jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
26610 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
26611 jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
26615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26616 if ((this_ptr & 1) != 0) return;
26617 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26618 CHECK_ACCESS(this_ptr_ptr);
26619 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
26620 FREE((void*)this_ptr);
26621 KeysInterface_free(this_ptr_conv);
26624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26625 LDKInMemorySigner this_obj_conv;
26626 this_obj_conv.inner = (void*)(this_obj & (~1));
26627 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26629 InMemorySigner_free(this_obj_conv);
26632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
26633 LDKInMemorySigner this_ptr_conv;
26634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26635 this_ptr_conv.is_owned = false;
26636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26637 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26638 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
26642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26643 LDKInMemorySigner this_ptr_conv;
26644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26645 this_ptr_conv.is_owned = false;
26646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26647 LDKSecretKey val_ref;
26648 CHECK((*env)->GetArrayLength(env, val) == 32);
26649 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
26650 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
26653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
26654 LDKInMemorySigner this_ptr_conv;
26655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26656 this_ptr_conv.is_owned = false;
26657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26658 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26659 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
26663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26664 LDKInMemorySigner this_ptr_conv;
26665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26666 this_ptr_conv.is_owned = false;
26667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26668 LDKSecretKey val_ref;
26669 CHECK((*env)->GetArrayLength(env, val) == 32);
26670 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
26671 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
26674 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
26675 LDKInMemorySigner this_ptr_conv;
26676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26677 this_ptr_conv.is_owned = false;
26678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26679 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26680 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
26684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26685 LDKInMemorySigner this_ptr_conv;
26686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26687 this_ptr_conv.is_owned = false;
26688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26689 LDKSecretKey val_ref;
26690 CHECK((*env)->GetArrayLength(env, val) == 32);
26691 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
26692 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
26695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
26696 LDKInMemorySigner this_ptr_conv;
26697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26698 this_ptr_conv.is_owned = false;
26699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26700 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26701 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
26705 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) {
26706 LDKInMemorySigner this_ptr_conv;
26707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26708 this_ptr_conv.is_owned = false;
26709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26710 LDKSecretKey val_ref;
26711 CHECK((*env)->GetArrayLength(env, val) == 32);
26712 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
26713 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
26716 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
26717 LDKInMemorySigner this_ptr_conv;
26718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26719 this_ptr_conv.is_owned = false;
26720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26721 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26722 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
26726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26727 LDKInMemorySigner this_ptr_conv;
26728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26729 this_ptr_conv.is_owned = false;
26730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26731 LDKSecretKey val_ref;
26732 CHECK((*env)->GetArrayLength(env, val) == 32);
26733 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
26734 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
26737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
26738 LDKInMemorySigner this_ptr_conv;
26739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26740 this_ptr_conv.is_owned = false;
26741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26742 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26743 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
26747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26748 LDKInMemorySigner this_ptr_conv;
26749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26750 this_ptr_conv.is_owned = false;
26751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26752 LDKThirtyTwoBytes val_ref;
26753 CHECK((*env)->GetArrayLength(env, val) == 32);
26754 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26755 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
26758 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
26759 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
26760 uintptr_t ret_ref = 0;
26761 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26762 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26763 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26764 ret_ref = (uintptr_t)ret_var.inner;
26765 if (ret_var.is_owned) {
26770 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26771 LDKInMemorySigner arg_conv;
26772 arg_conv.inner = (void*)(arg & (~1));
26773 arg_conv.is_owned = false;
26774 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26775 intptr_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
26779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26780 LDKInMemorySigner orig_conv;
26781 orig_conv.inner = (void*)(orig & (~1));
26782 orig_conv.is_owned = false;
26783 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26784 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
26785 uintptr_t ret_ref = 0;
26786 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26787 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26789 ret_ref = (uintptr_t)ret_var.inner;
26790 if (ret_var.is_owned) {
26796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray node_secret, 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) {
26797 LDKSecretKey node_secret_ref;
26798 CHECK((*env)->GetArrayLength(env, node_secret) == 32);
26799 (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
26800 LDKSecretKey funding_key_ref;
26801 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
26802 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
26803 LDKSecretKey revocation_base_key_ref;
26804 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
26805 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
26806 LDKSecretKey payment_key_ref;
26807 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
26808 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
26809 LDKSecretKey delayed_payment_base_key_ref;
26810 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
26811 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
26812 LDKSecretKey htlc_base_key_ref;
26813 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
26814 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
26815 LDKThirtyTwoBytes commitment_seed_ref;
26816 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
26817 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
26818 LDKThirtyTwoBytes channel_keys_id_ref;
26819 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
26820 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
26821 LDKInMemorySigner ret_var = InMemorySigner_new(node_secret_ref, 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);
26822 uintptr_t ret_ref = 0;
26823 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26824 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26825 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26826 ret_ref = (uintptr_t)ret_var.inner;
26827 if (ret_var.is_owned) {
26833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
26834 LDKInMemorySigner this_arg_conv;
26835 this_arg_conv.inner = (void*)(this_arg & (~1));
26836 this_arg_conv.is_owned = false;
26837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26838 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
26839 uintptr_t ret_ref = 0;
26840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26843 ret_ref = (uintptr_t)ret_var.inner;
26844 if (ret_var.is_owned) {
26850 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
26851 LDKInMemorySigner this_arg_conv;
26852 this_arg_conv.inner = (void*)(this_arg & (~1));
26853 this_arg_conv.is_owned = false;
26854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26855 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
26859 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
26860 LDKInMemorySigner this_arg_conv;
26861 this_arg_conv.inner = (void*)(this_arg & (~1));
26862 this_arg_conv.is_owned = false;
26863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26864 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
26868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
26869 LDKInMemorySigner this_arg_conv;
26870 this_arg_conv.inner = (void*)(this_arg & (~1));
26871 this_arg_conv.is_owned = false;
26872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26873 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
26877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
26878 LDKInMemorySigner this_arg_conv;
26879 this_arg_conv.inner = (void*)(this_arg & (~1));
26880 this_arg_conv.is_owned = false;
26881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26882 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
26883 uintptr_t ret_ref = 0;
26884 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26885 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26887 ret_ref = (uintptr_t)ret_var.inner;
26888 if (ret_var.is_owned) {
26894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
26895 LDKInMemorySigner this_arg_conv;
26896 this_arg_conv.inner = (void*)(this_arg & (~1));
26897 this_arg_conv.is_owned = false;
26898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26899 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
26900 uintptr_t ret_ref = 0;
26901 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26902 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26904 ret_ref = (uintptr_t)ret_var.inner;
26905 if (ret_var.is_owned) {
26911 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
26912 LDKInMemorySigner this_arg_conv;
26913 this_arg_conv.inner = (void*)(this_arg & (~1));
26914 this_arg_conv.is_owned = false;
26915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26916 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
26920 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) {
26921 LDKInMemorySigner this_arg_conv;
26922 this_arg_conv.inner = (void*)(this_arg & (~1));
26923 this_arg_conv.is_owned = false;
26924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26925 LDKTransaction spend_tx_ref;
26926 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
26927 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26928 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
26929 spend_tx_ref.data_is_owned = true;
26930 LDKStaticPaymentOutputDescriptor descriptor_conv;
26931 descriptor_conv.inner = (void*)(descriptor & (~1));
26932 descriptor_conv.is_owned = false;
26933 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26934 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26935 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26936 return (uintptr_t)ret_conv;
26939 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) {
26940 LDKInMemorySigner this_arg_conv;
26941 this_arg_conv.inner = (void*)(this_arg & (~1));
26942 this_arg_conv.is_owned = false;
26943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26944 LDKTransaction spend_tx_ref;
26945 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
26946 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26947 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
26948 spend_tx_ref.data_is_owned = true;
26949 LDKDelayedPaymentOutputDescriptor descriptor_conv;
26950 descriptor_conv.inner = (void*)(descriptor & (~1));
26951 descriptor_conv.is_owned = false;
26952 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26953 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26954 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26955 return (uintptr_t)ret_conv;
26958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
26959 LDKInMemorySigner this_arg_conv;
26960 this_arg_conv.inner = (void*)(this_arg & (~1));
26961 this_arg_conv.is_owned = false;
26962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26963 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
26964 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
26965 return (uintptr_t)ret_ret;
26968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
26969 LDKInMemorySigner this_arg_conv;
26970 this_arg_conv.inner = (void*)(this_arg & (~1));
26971 this_arg_conv.is_owned = false;
26972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26973 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26974 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
26975 return (uintptr_t)ret_ret;
26978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
26979 LDKInMemorySigner obj_conv;
26980 obj_conv.inner = (void*)(obj & (~1));
26981 obj_conv.is_owned = false;
26982 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26983 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
26984 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26985 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26986 CVec_u8Z_free(ret_var);
26990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
26991 LDKu8slice ser_ref;
26992 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26993 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26994 LDKSecretKey arg_ref;
26995 CHECK((*env)->GetArrayLength(env, arg) == 32);
26996 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
26997 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26998 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
26999 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27000 return (uintptr_t)ret_conv;
27003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27004 LDKKeysManager this_obj_conv;
27005 this_obj_conv.inner = (void*)(this_obj & (~1));
27006 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27008 KeysManager_free(this_obj_conv);
27011 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) {
27012 unsigned char seed_arr[32];
27013 CHECK((*env)->GetArrayLength(env, seed) == 32);
27014 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27015 unsigned char (*seed_ref)[32] = &seed_arr;
27016 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27017 uintptr_t ret_ref = 0;
27018 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27019 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27021 ret_ref = (uintptr_t)ret_var.inner;
27022 if (ret_var.is_owned) {
27028 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) {
27029 LDKKeysManager this_arg_conv;
27030 this_arg_conv.inner = (void*)(this_arg & (~1));
27031 this_arg_conv.is_owned = false;
27032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27033 unsigned char params_arr[32];
27034 CHECK((*env)->GetArrayLength(env, params) == 32);
27035 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27036 unsigned char (*params_ref)[32] = ¶ms_arr;
27037 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27038 uintptr_t ret_ref = 0;
27039 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27040 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27041 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27042 ret_ref = (uintptr_t)ret_var.inner;
27043 if (ret_var.is_owned) {
27049 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) {
27050 LDKKeysManager this_arg_conv;
27051 this_arg_conv.inner = (void*)(this_arg & (~1));
27052 this_arg_conv.is_owned = false;
27053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27054 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27055 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
27056 if (descriptors_constr.datalen > 0)
27057 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27059 descriptors_constr.data = NULL;
27060 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
27061 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27062 int64_t descriptors_conv_27 = descriptors_vals[b];
27063 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
27064 CHECK_ACCESS(descriptors_conv_27_ptr);
27065 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27066 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
27067 descriptors_constr.data[b] = descriptors_conv_27_conv;
27069 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
27070 LDKCVec_TxOutZ outputs_constr;
27071 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
27072 if (outputs_constr.datalen > 0)
27073 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27075 outputs_constr.data = NULL;
27076 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
27077 for (size_t h = 0; h < outputs_constr.datalen; h++) {
27078 int64_t outputs_conv_7 = outputs_vals[h];
27079 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
27080 CHECK_ACCESS(outputs_conv_7_ptr);
27081 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27082 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
27083 outputs_constr.data[h] = outputs_conv_7_conv;
27085 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
27086 LDKCVec_u8Z change_destination_script_ref;
27087 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
27088 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27089 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
27090 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27091 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27092 return (uintptr_t)ret_conv;
27095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
27096 LDKKeysManager this_arg_conv;
27097 this_arg_conv.inner = (void*)(this_arg & (~1));
27098 this_arg_conv.is_owned = false;
27099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27100 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
27101 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
27102 return (uintptr_t)ret_ret;
27105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27106 LDKPhantomKeysManager this_obj_conv;
27107 this_obj_conv.inner = (void*)(this_obj & (~1));
27108 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27110 PhantomKeysManager_free(this_obj_conv);
27113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
27114 LDKPhantomKeysManager this_arg_conv;
27115 this_arg_conv.inner = (void*)(this_arg & (~1));
27116 this_arg_conv.is_owned = false;
27117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27118 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
27119 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
27120 return (uintptr_t)ret_ret;
27123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
27124 unsigned char seed_arr[32];
27125 CHECK((*env)->GetArrayLength(env, seed) == 32);
27126 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27127 unsigned char (*seed_ref)[32] = &seed_arr;
27128 unsigned char cross_node_seed_arr[32];
27129 CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
27130 (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
27131 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27132 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27133 uintptr_t ret_ref = 0;
27134 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27135 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27137 ret_ref = (uintptr_t)ret_var.inner;
27138 if (ret_var.is_owned) {
27144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_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) {
27145 LDKPhantomKeysManager this_arg_conv;
27146 this_arg_conv.inner = (void*)(this_arg & (~1));
27147 this_arg_conv.is_owned = false;
27148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27149 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27150 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
27151 if (descriptors_constr.datalen > 0)
27152 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27154 descriptors_constr.data = NULL;
27155 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
27156 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27157 int64_t descriptors_conv_27 = descriptors_vals[b];
27158 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
27159 CHECK_ACCESS(descriptors_conv_27_ptr);
27160 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27161 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
27162 descriptors_constr.data[b] = descriptors_conv_27_conv;
27164 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
27165 LDKCVec_TxOutZ outputs_constr;
27166 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
27167 if (outputs_constr.datalen > 0)
27168 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27170 outputs_constr.data = NULL;
27171 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
27172 for (size_t h = 0; h < outputs_constr.datalen; h++) {
27173 int64_t outputs_conv_7 = outputs_vals[h];
27174 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
27175 CHECK_ACCESS(outputs_conv_7_ptr);
27176 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27177 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
27178 outputs_constr.data[h] = outputs_conv_7_conv;
27180 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
27181 LDKCVec_u8Z change_destination_script_ref;
27182 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
27183 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27184 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
27185 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27186 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27187 return (uintptr_t)ret_conv;
27190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
27191 LDKPhantomKeysManager this_arg_conv;
27192 this_arg_conv.inner = (void*)(this_arg & (~1));
27193 this_arg_conv.is_owned = false;
27194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27195 unsigned char params_arr[32];
27196 CHECK((*env)->GetArrayLength(env, params) == 32);
27197 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27198 unsigned char (*params_ref)[32] = ¶ms_arr;
27199 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27200 uintptr_t ret_ref = 0;
27201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27204 ret_ref = (uintptr_t)ret_var.inner;
27205 if (ret_var.is_owned) {
27211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27212 LDKChannelManager this_obj_conv;
27213 this_obj_conv.inner = (void*)(this_obj & (~1));
27214 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27216 ChannelManager_free(this_obj_conv);
27219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27220 LDKChainParameters this_obj_conv;
27221 this_obj_conv.inner = (void*)(this_obj & (~1));
27222 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27224 ChainParameters_free(this_obj_conv);
27227 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
27228 LDKChainParameters this_ptr_conv;
27229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27230 this_ptr_conv.is_owned = false;
27231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27232 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
27236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
27237 LDKChainParameters this_ptr_conv;
27238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27239 this_ptr_conv.is_owned = false;
27240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27241 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
27242 ChainParameters_set_network(&this_ptr_conv, val_conv);
27245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
27246 LDKChainParameters this_ptr_conv;
27247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27248 this_ptr_conv.is_owned = false;
27249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27250 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27251 uintptr_t ret_ref = 0;
27252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27255 ret_ref = (uintptr_t)ret_var.inner;
27256 if (ret_var.is_owned) {
27262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27263 LDKChainParameters this_ptr_conv;
27264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27265 this_ptr_conv.is_owned = false;
27266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27267 LDKBestBlock val_conv;
27268 val_conv.inner = (void*)(val & (~1));
27269 val_conv.is_owned = (val & 1) || (val == 0);
27270 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27271 val_conv = BestBlock_clone(&val_conv);
27272 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
27276 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
27277 LDKBestBlock best_block_arg_conv;
27278 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
27279 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
27280 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27281 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27282 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27283 uintptr_t ret_ref = 0;
27284 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27285 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27287 ret_ref = (uintptr_t)ret_var.inner;
27288 if (ret_var.is_owned) {
27294 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27295 LDKChainParameters ret_var = ChainParameters_clone(arg);
27296 uintptr_t ret_ref = 0;
27297 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27298 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27300 ret_ref = (uintptr_t)ret_var.inner;
27301 if (ret_var.is_owned) {
27306 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27307 LDKChainParameters arg_conv;
27308 arg_conv.inner = (void*)(arg & (~1));
27309 arg_conv.is_owned = false;
27310 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27311 intptr_t ret_val = ChainParameters_clone_ptr(&arg_conv);
27315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27316 LDKChainParameters orig_conv;
27317 orig_conv.inner = (void*)(orig & (~1));
27318 orig_conv.is_owned = false;
27319 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27320 LDKChainParameters ret_var = ChainParameters_clone(&orig_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 void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27333 LDKCounterpartyForwardingInfo this_obj_conv;
27334 this_obj_conv.inner = (void*)(this_obj & (~1));
27335 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27337 CounterpartyForwardingInfo_free(this_obj_conv);
27340 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27341 LDKCounterpartyForwardingInfo this_ptr_conv;
27342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27343 this_ptr_conv.is_owned = false;
27344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27345 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27350 LDKCounterpartyForwardingInfo this_ptr_conv;
27351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27352 this_ptr_conv.is_owned = false;
27353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27354 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27357 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
27358 LDKCounterpartyForwardingInfo this_ptr_conv;
27359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27360 this_ptr_conv.is_owned = false;
27361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27362 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27367 LDKCounterpartyForwardingInfo this_ptr_conv;
27368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27369 this_ptr_conv.is_owned = false;
27370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27371 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27374 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
27375 LDKCounterpartyForwardingInfo this_ptr_conv;
27376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27377 this_ptr_conv.is_owned = false;
27378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27379 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27384 LDKCounterpartyForwardingInfo this_ptr_conv;
27385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27386 this_ptr_conv.is_owned = false;
27387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27388 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27391 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) {
27392 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27393 uintptr_t ret_ref = 0;
27394 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27395 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27397 ret_ref = (uintptr_t)ret_var.inner;
27398 if (ret_var.is_owned) {
27404 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27405 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27406 uintptr_t ret_ref = 0;
27407 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27408 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27410 ret_ref = (uintptr_t)ret_var.inner;
27411 if (ret_var.is_owned) {
27416 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27417 LDKCounterpartyForwardingInfo arg_conv;
27418 arg_conv.inner = (void*)(arg & (~1));
27419 arg_conv.is_owned = false;
27420 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27421 intptr_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27426 LDKCounterpartyForwardingInfo orig_conv;
27427 orig_conv.inner = (void*)(orig & (~1));
27428 orig_conv.is_owned = false;
27429 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27430 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27431 uintptr_t ret_ref = 0;
27432 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27433 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27434 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27435 ret_ref = (uintptr_t)ret_var.inner;
27436 if (ret_var.is_owned) {
27442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27443 LDKChannelCounterparty this_obj_conv;
27444 this_obj_conv.inner = (void*)(this_obj & (~1));
27445 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27447 ChannelCounterparty_free(this_obj_conv);
27450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27451 LDKChannelCounterparty this_ptr_conv;
27452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27453 this_ptr_conv.is_owned = false;
27454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27455 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27456 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
27460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27461 LDKChannelCounterparty this_ptr_conv;
27462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27463 this_ptr_conv.is_owned = false;
27464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27465 LDKPublicKey val_ref;
27466 CHECK((*env)->GetArrayLength(env, val) == 33);
27467 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27468 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27472 LDKChannelCounterparty this_ptr_conv;
27473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27474 this_ptr_conv.is_owned = false;
27475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27476 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27477 uintptr_t ret_ref = 0;
27478 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27479 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27480 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27481 ret_ref = (uintptr_t)ret_var.inner;
27482 if (ret_var.is_owned) {
27488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27489 LDKChannelCounterparty this_ptr_conv;
27490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27491 this_ptr_conv.is_owned = false;
27492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27493 LDKInitFeatures val_conv;
27494 val_conv.inner = (void*)(val & (~1));
27495 val_conv.is_owned = (val & 1) || (val == 0);
27496 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27497 val_conv = InitFeatures_clone(&val_conv);
27498 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
27501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
27502 LDKChannelCounterparty this_ptr_conv;
27503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27504 this_ptr_conv.is_owned = false;
27505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27506 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
27510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27511 LDKChannelCounterparty this_ptr_conv;
27512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27513 this_ptr_conv.is_owned = false;
27514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27515 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
27518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
27519 LDKChannelCounterparty this_ptr_conv;
27520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27521 this_ptr_conv.is_owned = false;
27522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27523 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
27524 uintptr_t ret_ref = 0;
27525 if ((uintptr_t)ret_var.inner > 4096) {
27526 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27527 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27528 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27529 ret_ref = (uintptr_t)ret_var.inner;
27530 if (ret_var.is_owned) {
27537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27538 LDKChannelCounterparty this_ptr_conv;
27539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27540 this_ptr_conv.is_owned = false;
27541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27542 LDKCounterpartyForwardingInfo val_conv;
27543 val_conv.inner = (void*)(val & (~1));
27544 val_conv.is_owned = (val & 1) || (val == 0);
27545 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27546 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
27547 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
27550 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) {
27551 LDKPublicKey node_id_arg_ref;
27552 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
27553 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
27554 LDKInitFeatures features_arg_conv;
27555 features_arg_conv.inner = (void*)(features_arg & (~1));
27556 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27557 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27558 features_arg_conv = InitFeatures_clone(&features_arg_conv);
27559 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
27560 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
27561 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
27562 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
27563 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
27564 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
27565 uintptr_t ret_ref = 0;
27566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27569 ret_ref = (uintptr_t)ret_var.inner;
27570 if (ret_var.is_owned) {
27576 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
27577 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
27578 uintptr_t ret_ref = 0;
27579 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27580 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27581 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27582 ret_ref = (uintptr_t)ret_var.inner;
27583 if (ret_var.is_owned) {
27588 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27589 LDKChannelCounterparty arg_conv;
27590 arg_conv.inner = (void*)(arg & (~1));
27591 arg_conv.is_owned = false;
27592 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27593 intptr_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
27597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27598 LDKChannelCounterparty orig_conv;
27599 orig_conv.inner = (void*)(orig & (~1));
27600 orig_conv.is_owned = false;
27601 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27602 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
27603 uintptr_t ret_ref = 0;
27604 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27605 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27606 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27607 ret_ref = (uintptr_t)ret_var.inner;
27608 if (ret_var.is_owned) {
27614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27615 LDKChannelDetails this_obj_conv;
27616 this_obj_conv.inner = (void*)(this_obj & (~1));
27617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27619 ChannelDetails_free(this_obj_conv);
27622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27623 LDKChannelDetails this_ptr_conv;
27624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27625 this_ptr_conv.is_owned = false;
27626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27627 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27628 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
27632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27633 LDKChannelDetails this_ptr_conv;
27634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27635 this_ptr_conv.is_owned = false;
27636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27637 LDKThirtyTwoBytes val_ref;
27638 CHECK((*env)->GetArrayLength(env, val) == 32);
27639 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27640 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
27643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
27644 LDKChannelDetails this_ptr_conv;
27645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27646 this_ptr_conv.is_owned = false;
27647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27648 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
27649 uintptr_t ret_ref = 0;
27650 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27651 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27652 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27653 ret_ref = (uintptr_t)ret_var.inner;
27654 if (ret_var.is_owned) {
27660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27661 LDKChannelDetails this_ptr_conv;
27662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27663 this_ptr_conv.is_owned = false;
27664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27665 LDKChannelCounterparty val_conv;
27666 val_conv.inner = (void*)(val & (~1));
27667 val_conv.is_owned = (val & 1) || (val == 0);
27668 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27669 val_conv = ChannelCounterparty_clone(&val_conv);
27670 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
27673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
27674 LDKChannelDetails this_ptr_conv;
27675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27676 this_ptr_conv.is_owned = false;
27677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27678 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
27679 uintptr_t ret_ref = 0;
27680 if ((uintptr_t)ret_var.inner > 4096) {
27681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27684 ret_ref = (uintptr_t)ret_var.inner;
27685 if (ret_var.is_owned) {
27692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27693 LDKChannelDetails this_ptr_conv;
27694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27695 this_ptr_conv.is_owned = false;
27696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27697 LDKOutPoint val_conv;
27698 val_conv.inner = (void*)(val & (~1));
27699 val_conv.is_owned = (val & 1) || (val == 0);
27700 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27701 val_conv = OutPoint_clone(&val_conv);
27702 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
27705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27706 LDKChannelDetails this_ptr_conv;
27707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27708 this_ptr_conv.is_owned = false;
27709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27710 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27711 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
27712 uintptr_t ret_ref = (uintptr_t)ret_copy;
27716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27717 LDKChannelDetails this_ptr_conv;
27718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27719 this_ptr_conv.is_owned = false;
27720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27721 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27722 CHECK_ACCESS(val_ptr);
27723 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27724 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
27725 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
27728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27729 LDKChannelDetails this_ptr_conv;
27730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27731 this_ptr_conv.is_owned = false;
27732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27733 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
27737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27738 LDKChannelDetails this_ptr_conv;
27739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27740 this_ptr_conv.is_owned = false;
27741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27742 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
27745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
27746 LDKChannelDetails this_ptr_conv;
27747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27748 this_ptr_conv.is_owned = false;
27749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27750 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27751 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
27752 uintptr_t ret_ref = (uintptr_t)ret_copy;
27756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27757 LDKChannelDetails this_ptr_conv;
27758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27759 this_ptr_conv.is_owned = false;
27760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27761 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27762 CHECK_ACCESS(val_ptr);
27763 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27764 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
27765 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
27768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27769 LDKChannelDetails this_ptr_conv;
27770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27771 this_ptr_conv.is_owned = false;
27772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27773 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
27777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27778 LDKChannelDetails this_ptr_conv;
27779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27780 this_ptr_conv.is_owned = false;
27781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27782 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
27785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27786 LDKChannelDetails this_ptr_conv;
27787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27788 this_ptr_conv.is_owned = false;
27789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27790 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
27794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27795 LDKChannelDetails this_ptr_conv;
27796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27797 this_ptr_conv.is_owned = false;
27798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27799 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
27802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27803 LDKChannelDetails this_ptr_conv;
27804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27805 this_ptr_conv.is_owned = false;
27806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27807 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
27811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27812 LDKChannelDetails this_ptr_conv;
27813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27814 this_ptr_conv.is_owned = false;
27815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27816 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
27819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27820 LDKChannelDetails this_ptr_conv;
27821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27822 this_ptr_conv.is_owned = false;
27823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27824 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
27828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27829 LDKChannelDetails this_ptr_conv;
27830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27831 this_ptr_conv.is_owned = false;
27832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27833 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
27836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
27837 LDKChannelDetails this_ptr_conv;
27838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27839 this_ptr_conv.is_owned = false;
27840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27841 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
27842 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
27843 uintptr_t ret_ref = (uintptr_t)ret_copy;
27847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27848 LDKChannelDetails this_ptr_conv;
27849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27850 this_ptr_conv.is_owned = false;
27851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27852 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27853 CHECK_ACCESS(val_ptr);
27854 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
27855 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
27856 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
27859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
27860 LDKChannelDetails this_ptr_conv;
27861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27862 this_ptr_conv.is_owned = false;
27863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27864 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
27865 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
27866 uintptr_t ret_ref = (uintptr_t)ret_copy;
27870 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) {
27871 LDKChannelDetails 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 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27876 CHECK_ACCESS(val_ptr);
27877 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
27878 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
27879 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
27882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
27883 LDKChannelDetails this_ptr_conv;
27884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27885 this_ptr_conv.is_owned = false;
27886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27887 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
27891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27892 LDKChannelDetails this_ptr_conv;
27893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27894 this_ptr_conv.is_owned = false;
27895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27896 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
27899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
27900 LDKChannelDetails this_ptr_conv;
27901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27902 this_ptr_conv.is_owned = false;
27903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27904 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
27908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27909 LDKChannelDetails this_ptr_conv;
27910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27911 this_ptr_conv.is_owned = false;
27912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27913 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
27916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
27917 LDKChannelDetails this_ptr_conv;
27918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27919 this_ptr_conv.is_owned = false;
27920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27921 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
27925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27926 LDKChannelDetails this_ptr_conv;
27927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27928 this_ptr_conv.is_owned = false;
27929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27930 ChannelDetails_set_is_usable(&this_ptr_conv, val);
27933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
27934 LDKChannelDetails this_ptr_conv;
27935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27936 this_ptr_conv.is_owned = false;
27937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27938 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
27942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27943 LDKChannelDetails this_ptr_conv;
27944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27945 this_ptr_conv.is_owned = false;
27946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27947 ChannelDetails_set_is_public(&this_ptr_conv, val);
27950 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) {
27951 LDKThirtyTwoBytes channel_id_arg_ref;
27952 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
27953 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
27954 LDKChannelCounterparty counterparty_arg_conv;
27955 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
27956 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
27957 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
27958 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
27959 LDKOutPoint funding_txo_arg_conv;
27960 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
27961 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
27962 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
27963 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
27964 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
27965 CHECK_ACCESS(short_channel_id_arg_ptr);
27966 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
27967 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
27968 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
27969 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
27970 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
27971 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
27972 CHECK_ACCESS(confirmations_required_arg_ptr);
27973 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
27974 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
27975 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
27976 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
27977 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
27978 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
27979 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);
27980 uintptr_t ret_ref = 0;
27981 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27982 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27983 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27984 ret_ref = (uintptr_t)ret_var.inner;
27985 if (ret_var.is_owned) {
27991 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
27992 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
27993 uintptr_t ret_ref = 0;
27994 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27995 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27997 ret_ref = (uintptr_t)ret_var.inner;
27998 if (ret_var.is_owned) {
28003 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28004 LDKChannelDetails arg_conv;
28005 arg_conv.inner = (void*)(arg & (~1));
28006 arg_conv.is_owned = false;
28007 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28008 intptr_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
28012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28013 LDKChannelDetails orig_conv;
28014 orig_conv.inner = (void*)(orig & (~1));
28015 orig_conv.is_owned = false;
28016 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28017 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28018 uintptr_t ret_ref = 0;
28019 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28020 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28021 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28022 ret_ref = (uintptr_t)ret_var.inner;
28023 if (ret_var.is_owned) {
28029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28030 if ((this_ptr & 1) != 0) return;
28031 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28032 CHECK_ACCESS(this_ptr_ptr);
28033 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
28034 FREE((void*)this_ptr);
28035 PaymentSendFailure_free(this_ptr_conv);
28038 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
28039 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28040 *ret_copy = PaymentSendFailure_clone(arg);
28041 uintptr_t ret_ref = (uintptr_t)ret_copy;
28044 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28045 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
28046 intptr_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
28050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28051 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
28052 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28053 *ret_copy = PaymentSendFailure_clone(orig_conv);
28054 uintptr_t ret_ref = (uintptr_t)ret_copy;
28058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
28059 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
28060 CHECK_ACCESS(a_ptr);
28061 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
28062 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
28063 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28064 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
28065 uintptr_t ret_ref = (uintptr_t)ret_copy;
28069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
28070 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
28071 a_constr.datalen = (*env)->GetArrayLength(env, a);
28072 if (a_constr.datalen > 0)
28073 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28075 a_constr.data = NULL;
28076 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
28077 for (size_t w = 0; w < a_constr.datalen; w++) {
28078 int64_t a_conv_22 = a_vals[w];
28079 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
28080 CHECK_ACCESS(a_conv_22_ptr);
28081 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
28082 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
28083 a_constr.data[w] = a_conv_22_conv;
28085 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
28086 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28087 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
28088 uintptr_t ret_ref = (uintptr_t)ret_copy;
28092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
28093 LDKCVec_APIErrorZ a_constr;
28094 a_constr.datalen = (*env)->GetArrayLength(env, a);
28095 if (a_constr.datalen > 0)
28096 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
28098 a_constr.data = NULL;
28099 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
28100 for (size_t k = 0; k < a_constr.datalen; k++) {
28101 int64_t a_conv_10 = a_vals[k];
28102 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
28103 CHECK_ACCESS(a_conv_10_ptr);
28104 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
28105 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
28106 a_constr.data[k] = a_conv_10_conv;
28108 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
28109 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28110 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
28111 uintptr_t ret_ref = (uintptr_t)ret_copy;
28115 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) {
28116 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
28117 results_constr.datalen = (*env)->GetArrayLength(env, results);
28118 if (results_constr.datalen > 0)
28119 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28121 results_constr.data = NULL;
28122 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
28123 for (size_t w = 0; w < results_constr.datalen; w++) {
28124 int64_t results_conv_22 = results_vals[w];
28125 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
28126 CHECK_ACCESS(results_conv_22_ptr);
28127 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
28128 results_constr.data[w] = results_conv_22_conv;
28130 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
28131 LDKRouteParameters failed_paths_retry_conv;
28132 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
28133 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
28134 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
28135 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
28136 LDKThirtyTwoBytes payment_id_ref;
28137 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
28138 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
28139 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28140 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
28141 uintptr_t ret_ref = (uintptr_t)ret_copy;
28145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28146 LDKPhantomRouteHints this_obj_conv;
28147 this_obj_conv.inner = (void*)(this_obj & (~1));
28148 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28150 PhantomRouteHints_free(this_obj_conv);
28153 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
28154 LDKPhantomRouteHints this_ptr_conv;
28155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28156 this_ptr_conv.is_owned = false;
28157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28158 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28159 int64_tArray ret_arr = NULL;
28160 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28161 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28162 for (size_t q = 0; q < ret_var.datalen; q++) {
28163 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28164 uintptr_t ret_conv_16_ref = 0;
28165 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28166 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28168 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
28169 if (ret_conv_16_var.is_owned) {
28170 ret_conv_16_ref |= 1;
28172 ret_arr_ptr[q] = ret_conv_16_ref;
28174 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28175 FREE(ret_var.data);
28179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
28180 LDKPhantomRouteHints this_ptr_conv;
28181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28182 this_ptr_conv.is_owned = false;
28183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28184 LDKCVec_ChannelDetailsZ val_constr;
28185 val_constr.datalen = (*env)->GetArrayLength(env, val);
28186 if (val_constr.datalen > 0)
28187 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28189 val_constr.data = NULL;
28190 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
28191 for (size_t q = 0; q < val_constr.datalen; q++) {
28192 int64_t val_conv_16 = val_vals[q];
28193 LDKChannelDetails val_conv_16_conv;
28194 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
28195 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
28196 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28197 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28198 val_constr.data[q] = val_conv_16_conv;
28200 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
28201 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
28205 LDKPhantomRouteHints this_ptr_conv;
28206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28207 this_ptr_conv.is_owned = false;
28208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28209 int64_t ret_val = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28214 LDKPhantomRouteHints this_ptr_conv;
28215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28216 this_ptr_conv.is_owned = false;
28217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28218 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28222 LDKPhantomRouteHints this_ptr_conv;
28223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28224 this_ptr_conv.is_owned = false;
28225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28226 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28227 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
28231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28232 LDKPhantomRouteHints this_ptr_conv;
28233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28234 this_ptr_conv.is_owned = false;
28235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28236 LDKPublicKey val_ref;
28237 CHECK((*env)->GetArrayLength(env, val) == 33);
28238 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28239 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
28243 LDKCVec_ChannelDetailsZ channels_arg_constr;
28244 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
28245 if (channels_arg_constr.datalen > 0)
28246 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28248 channels_arg_constr.data = NULL;
28249 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
28250 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28251 int64_t channels_arg_conv_16 = channels_arg_vals[q];
28252 LDKChannelDetails channels_arg_conv_16_conv;
28253 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
28254 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
28255 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28256 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28257 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28259 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
28260 LDKPublicKey real_node_pubkey_arg_ref;
28261 CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
28262 (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
28263 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28264 uintptr_t ret_ref = 0;
28265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28268 ret_ref = (uintptr_t)ret_var.inner;
28269 if (ret_var.is_owned) {
28275 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28276 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28277 uintptr_t ret_ref = 0;
28278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28281 ret_ref = (uintptr_t)ret_var.inner;
28282 if (ret_var.is_owned) {
28287 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28288 LDKPhantomRouteHints arg_conv;
28289 arg_conv.inner = (void*)(arg & (~1));
28290 arg_conv.is_owned = false;
28291 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28292 intptr_t ret_val = PhantomRouteHints_clone_ptr(&arg_conv);
28296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28297 LDKPhantomRouteHints orig_conv;
28298 orig_conv.inner = (void*)(orig & (~1));
28299 orig_conv.is_owned = false;
28300 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28301 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28302 uintptr_t ret_ref = 0;
28303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28306 ret_ref = (uintptr_t)ret_var.inner;
28307 if (ret_var.is_owned) {
28313 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) {
28314 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
28315 CHECK_ACCESS(fee_est_ptr);
28316 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28317 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28318 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28319 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28321 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
28322 CHECK_ACCESS(chain_monitor_ptr);
28323 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28324 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28325 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28326 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28328 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
28329 CHECK_ACCESS(tx_broadcaster_ptr);
28330 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28331 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28332 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28333 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28335 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
28336 CHECK_ACCESS(logger_ptr);
28337 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28338 if (logger_conv.free == LDKLogger_JCalls_free) {
28339 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28340 LDKLogger_JCalls_cloned(&logger_conv);
28342 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
28343 CHECK_ACCESS(keys_manager_ptr);
28344 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28345 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28346 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28347 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28349 LDKUserConfig config_conv;
28350 config_conv.inner = (void*)(config & (~1));
28351 config_conv.is_owned = (config & 1) || (config == 0);
28352 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28353 config_conv = UserConfig_clone(&config_conv);
28354 LDKChainParameters params_conv;
28355 params_conv.inner = (void*)(params & (~1));
28356 params_conv.is_owned = (params & 1) || (params == 0);
28357 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28358 params_conv = ChainParameters_clone(¶ms_conv);
28359 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
28360 uintptr_t ret_ref = 0;
28361 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28362 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28364 ret_ref = (uintptr_t)ret_var.inner;
28365 if (ret_var.is_owned) {
28371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
28372 LDKChannelManager this_arg_conv;
28373 this_arg_conv.inner = (void*)(this_arg & (~1));
28374 this_arg_conv.is_owned = false;
28375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28376 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28377 uintptr_t ret_ref = 0;
28378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28381 ret_ref = (uintptr_t)ret_var.inner;
28382 if (ret_var.is_owned) {
28388 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) {
28389 LDKChannelManager this_arg_conv;
28390 this_arg_conv.inner = (void*)(this_arg & (~1));
28391 this_arg_conv.is_owned = false;
28392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28393 LDKPublicKey their_network_key_ref;
28394 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
28395 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
28396 LDKUserConfig override_config_conv;
28397 override_config_conv.inner = (void*)(override_config & (~1));
28398 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
28399 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28400 override_config_conv = UserConfig_clone(&override_config_conv);
28401 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28402 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
28403 return (uintptr_t)ret_conv;
28406 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
28407 LDKChannelManager this_arg_conv;
28408 this_arg_conv.inner = (void*)(this_arg & (~1));
28409 this_arg_conv.is_owned = false;
28410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28411 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
28412 int64_tArray ret_arr = NULL;
28413 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28414 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28415 for (size_t q = 0; q < ret_var.datalen; q++) {
28416 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28417 uintptr_t ret_conv_16_ref = 0;
28418 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28419 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28421 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
28422 if (ret_conv_16_var.is_owned) {
28423 ret_conv_16_ref |= 1;
28425 ret_arr_ptr[q] = ret_conv_16_ref;
28427 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28428 FREE(ret_var.data);
28432 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
28433 LDKChannelManager this_arg_conv;
28434 this_arg_conv.inner = (void*)(this_arg & (~1));
28435 this_arg_conv.is_owned = false;
28436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28437 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
28438 int64_tArray ret_arr = NULL;
28439 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28440 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28441 for (size_t q = 0; q < ret_var.datalen; q++) {
28442 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28443 uintptr_t ret_conv_16_ref = 0;
28444 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28445 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28447 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
28448 if (ret_conv_16_var.is_owned) {
28449 ret_conv_16_ref |= 1;
28451 ret_arr_ptr[q] = ret_conv_16_ref;
28453 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28454 FREE(ret_var.data);
28458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
28459 LDKChannelManager this_arg_conv;
28460 this_arg_conv.inner = (void*)(this_arg & (~1));
28461 this_arg_conv.is_owned = false;
28462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28463 unsigned char channel_id_arr[32];
28464 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
28465 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
28466 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28467 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28468 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
28469 return (uintptr_t)ret_conv;
28472 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) {
28473 LDKChannelManager this_arg_conv;
28474 this_arg_conv.inner = (void*)(this_arg & (~1));
28475 this_arg_conv.is_owned = false;
28476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28477 unsigned char channel_id_arr[32];
28478 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
28479 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
28480 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28481 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28482 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
28483 return (uintptr_t)ret_conv;
28486 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) {
28487 LDKChannelManager this_arg_conv;
28488 this_arg_conv.inner = (void*)(this_arg & (~1));
28489 this_arg_conv.is_owned = false;
28490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28491 unsigned char channel_id_arr[32];
28492 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
28493 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
28494 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28495 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28496 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
28497 return (uintptr_t)ret_conv;
28500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
28501 LDKChannelManager this_arg_conv;
28502 this_arg_conv.inner = (void*)(this_arg & (~1));
28503 this_arg_conv.is_owned = false;
28504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28505 ChannelManager_force_close_all_channels(&this_arg_conv);
28508 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) {
28509 LDKChannelManager this_arg_conv;
28510 this_arg_conv.inner = (void*)(this_arg & (~1));
28511 this_arg_conv.is_owned = false;
28512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28513 LDKRoute route_conv;
28514 route_conv.inner = (void*)(route & (~1));
28515 route_conv.is_owned = false;
28516 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28517 LDKThirtyTwoBytes payment_hash_ref;
28518 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
28519 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
28520 LDKThirtyTwoBytes payment_secret_ref;
28521 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
28522 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
28523 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
28524 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
28525 return (uintptr_t)ret_conv;
28528 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) {
28529 LDKChannelManager this_arg_conv;
28530 this_arg_conv.inner = (void*)(this_arg & (~1));
28531 this_arg_conv.is_owned = false;
28532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28533 LDKRoute route_conv;
28534 route_conv.inner = (void*)(route & (~1));
28535 route_conv.is_owned = false;
28536 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28537 LDKThirtyTwoBytes payment_id_ref;
28538 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
28539 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
28540 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
28541 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
28542 return (uintptr_t)ret_conv;
28545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
28546 LDKChannelManager this_arg_conv;
28547 this_arg_conv.inner = (void*)(this_arg & (~1));
28548 this_arg_conv.is_owned = false;
28549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28550 LDKThirtyTwoBytes payment_id_ref;
28551 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
28552 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
28553 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
28556 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) {
28557 LDKChannelManager this_arg_conv;
28558 this_arg_conv.inner = (void*)(this_arg & (~1));
28559 this_arg_conv.is_owned = false;
28560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28561 LDKRoute route_conv;
28562 route_conv.inner = (void*)(route & (~1));
28563 route_conv.is_owned = false;
28564 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28565 LDKThirtyTwoBytes payment_preimage_ref;
28566 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
28567 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
28568 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
28569 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
28570 return (uintptr_t)ret_conv;
28573 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) {
28574 LDKChannelManager this_arg_conv;
28575 this_arg_conv.inner = (void*)(this_arg & (~1));
28576 this_arg_conv.is_owned = false;
28577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28578 unsigned char temporary_channel_id_arr[32];
28579 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
28580 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
28581 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
28582 LDKTransaction funding_transaction_ref;
28583 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
28584 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
28585 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
28586 funding_transaction_ref.data_is_owned = true;
28587 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28588 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
28589 return (uintptr_t)ret_conv;
28592 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) {
28593 LDKChannelManager this_arg_conv;
28594 this_arg_conv.inner = (void*)(this_arg & (~1));
28595 this_arg_conv.is_owned = false;
28596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28597 LDKThreeBytes rgb_ref;
28598 CHECK((*env)->GetArrayLength(env, rgb) == 3);
28599 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
28600 LDKThirtyTwoBytes alias_ref;
28601 CHECK((*env)->GetArrayLength(env, alias) == 32);
28602 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
28603 LDKCVec_NetAddressZ addresses_constr;
28604 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
28605 if (addresses_constr.datalen > 0)
28606 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
28608 addresses_constr.data = NULL;
28609 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
28610 for (size_t m = 0; m < addresses_constr.datalen; m++) {
28611 int64_t addresses_conv_12 = addresses_vals[m];
28612 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
28613 CHECK_ACCESS(addresses_conv_12_ptr);
28614 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
28615 addresses_constr.data[m] = addresses_conv_12_conv;
28617 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
28618 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
28621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
28622 LDKChannelManager this_arg_conv;
28623 this_arg_conv.inner = (void*)(this_arg & (~1));
28624 this_arg_conv.is_owned = false;
28625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28626 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
28629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
28630 LDKChannelManager this_arg_conv;
28631 this_arg_conv.inner = (void*)(this_arg & (~1));
28632 this_arg_conv.is_owned = false;
28633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28634 ChannelManager_timer_tick_occurred(&this_arg_conv);
28637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
28638 LDKChannelManager this_arg_conv;
28639 this_arg_conv.inner = (void*)(this_arg & (~1));
28640 this_arg_conv.is_owned = false;
28641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28642 unsigned char payment_hash_arr[32];
28643 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
28644 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
28645 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
28646 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
28650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
28651 LDKChannelManager this_arg_conv;
28652 this_arg_conv.inner = (void*)(this_arg & (~1));
28653 this_arg_conv.is_owned = false;
28654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28655 LDKThirtyTwoBytes payment_preimage_ref;
28656 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
28657 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
28658 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
28662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
28663 LDKChannelManager this_arg_conv;
28664 this_arg_conv.inner = (void*)(this_arg & (~1));
28665 this_arg_conv.is_owned = false;
28666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28667 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28668 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
28672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id) {
28673 LDKChannelManager this_arg_conv;
28674 this_arg_conv.inner = (void*)(this_arg & (~1));
28675 this_arg_conv.is_owned = false;
28676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28677 unsigned char temporary_channel_id_arr[32];
28678 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
28679 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
28680 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
28681 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28682 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref);
28683 return (uintptr_t)ret_conv;
28686 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) {
28687 LDKChannelManager this_arg_conv;
28688 this_arg_conv.inner = (void*)(this_arg & (~1));
28689 this_arg_conv.is_owned = false;
28690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28691 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
28692 CHECK_ACCESS(min_value_msat_ptr);
28693 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28694 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
28695 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
28696 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
28697 return (uintptr_t)ret_conv;
28700 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) {
28701 LDKChannelManager this_arg_conv;
28702 this_arg_conv.inner = (void*)(this_arg & (~1));
28703 this_arg_conv.is_owned = false;
28704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28705 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
28706 CHECK_ACCESS(min_value_msat_ptr);
28707 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28708 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
28709 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
28710 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
28711 return (uintptr_t)ret_conv;
28714 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) {
28715 LDKChannelManager this_arg_conv;
28716 this_arg_conv.inner = (void*)(this_arg & (~1));
28717 this_arg_conv.is_owned = false;
28718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28719 LDKThirtyTwoBytes payment_hash_ref;
28720 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
28721 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
28722 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
28723 CHECK_ACCESS(min_value_msat_ptr);
28724 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28725 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
28726 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
28727 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
28728 return (uintptr_t)ret_conv;
28731 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) {
28732 LDKChannelManager this_arg_conv;
28733 this_arg_conv.inner = (void*)(this_arg & (~1));
28734 this_arg_conv.is_owned = false;
28735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28736 LDKThirtyTwoBytes payment_hash_ref;
28737 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
28738 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
28739 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
28740 CHECK_ACCESS(min_value_msat_ptr);
28741 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28742 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
28743 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
28744 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
28745 return (uintptr_t)ret_conv;
28748 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) {
28749 LDKChannelManager this_arg_conv;
28750 this_arg_conv.inner = (void*)(this_arg & (~1));
28751 this_arg_conv.is_owned = false;
28752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28753 LDKThirtyTwoBytes payment_hash_ref;
28754 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
28755 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
28756 LDKThirtyTwoBytes payment_secret_ref;
28757 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
28758 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
28759 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
28760 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
28761 return (uintptr_t)ret_conv;
28764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
28765 LDKChannelManager this_arg_conv;
28766 this_arg_conv.inner = (void*)(this_arg & (~1));
28767 this_arg_conv.is_owned = false;
28768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28769 int64_t ret_val = ChannelManager_get_phantom_scid(&this_arg_conv);
28773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
28774 LDKChannelManager this_arg_conv;
28775 this_arg_conv.inner = (void*)(this_arg & (~1));
28776 this_arg_conv.is_owned = false;
28777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28778 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
28779 uintptr_t ret_ref = 0;
28780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28783 ret_ref = (uintptr_t)ret_var.inner;
28784 if (ret_var.is_owned) {
28790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
28791 LDKChannelManager this_arg_conv;
28792 this_arg_conv.inner = (void*)(this_arg & (~1));
28793 this_arg_conv.is_owned = false;
28794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28795 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28796 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
28797 return (uintptr_t)ret_ret;
28800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
28801 LDKChannelManager this_arg_conv;
28802 this_arg_conv.inner = (void*)(this_arg & (~1));
28803 this_arg_conv.is_owned = false;
28804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28805 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
28806 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
28807 return (uintptr_t)ret_ret;
28810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
28811 LDKChannelManager this_arg_conv;
28812 this_arg_conv.inner = (void*)(this_arg & (~1));
28813 this_arg_conv.is_owned = false;
28814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28815 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
28816 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
28817 return (uintptr_t)ret_ret;
28820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
28821 LDKChannelManager this_arg_conv;
28822 this_arg_conv.inner = (void*)(this_arg & (~1));
28823 this_arg_conv.is_owned = false;
28824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28825 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
28826 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
28827 return (uintptr_t)ret_ret;
28830 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) {
28831 LDKChannelManager this_arg_conv;
28832 this_arg_conv.inner = (void*)(this_arg & (~1));
28833 this_arg_conv.is_owned = false;
28834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28835 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
28839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
28840 LDKChannelManager this_arg_conv;
28841 this_arg_conv.inner = (void*)(this_arg & (~1));
28842 this_arg_conv.is_owned = false;
28843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28844 ChannelManager_await_persistable_update(&this_arg_conv);
28847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
28848 LDKChannelManager this_arg_conv;
28849 this_arg_conv.inner = (void*)(this_arg & (~1));
28850 this_arg_conv.is_owned = false;
28851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28852 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
28853 uintptr_t ret_ref = 0;
28854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28857 ret_ref = (uintptr_t)ret_var.inner;
28858 if (ret_var.is_owned) {
28864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
28865 LDKChannelManager this_arg_conv;
28866 this_arg_conv.inner = (void*)(this_arg & (~1));
28867 this_arg_conv.is_owned = false;
28868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28869 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
28870 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
28871 return (uintptr_t)ret_ret;
28874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
28875 LDKCounterpartyForwardingInfo obj_conv;
28876 obj_conv.inner = (void*)(obj & (~1));
28877 obj_conv.is_owned = false;
28878 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28879 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
28880 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28881 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28882 CVec_u8Z_free(ret_var);
28886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28887 LDKu8slice ser_ref;
28888 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28889 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28890 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28891 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
28892 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28893 return (uintptr_t)ret_conv;
28896 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
28897 LDKChannelCounterparty obj_conv;
28898 obj_conv.inner = (void*)(obj & (~1));
28899 obj_conv.is_owned = false;
28900 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28901 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
28902 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28903 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28904 CVec_u8Z_free(ret_var);
28908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28909 LDKu8slice ser_ref;
28910 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28911 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28912 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28913 *ret_conv = ChannelCounterparty_read(ser_ref);
28914 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28915 return (uintptr_t)ret_conv;
28918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
28919 LDKChannelDetails obj_conv;
28920 obj_conv.inner = (void*)(obj & (~1));
28921 obj_conv.is_owned = false;
28922 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28923 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
28924 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28925 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28926 CVec_u8Z_free(ret_var);
28930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28931 LDKu8slice ser_ref;
28932 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28933 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28934 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28935 *ret_conv = ChannelDetails_read(ser_ref);
28936 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28937 return (uintptr_t)ret_conv;
28940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
28941 LDKPhantomRouteHints obj_conv;
28942 obj_conv.inner = (void*)(obj & (~1));
28943 obj_conv.is_owned = false;
28944 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28945 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
28946 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28947 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28948 CVec_u8Z_free(ret_var);
28952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28953 LDKu8slice ser_ref;
28954 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28955 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28956 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28957 *ret_conv = PhantomRouteHints_read(ser_ref);
28958 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28959 return (uintptr_t)ret_conv;
28962 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
28963 LDKChannelManager obj_conv;
28964 obj_conv.inner = (void*)(obj & (~1));
28965 obj_conv.is_owned = false;
28966 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28967 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
28968 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28969 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28970 CVec_u8Z_free(ret_var);
28974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28975 LDKChannelManagerReadArgs this_obj_conv;
28976 this_obj_conv.inner = (void*)(this_obj & (~1));
28977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28979 ChannelManagerReadArgs_free(this_obj_conv);
28982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
28983 LDKChannelManagerReadArgs this_ptr_conv;
28984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28985 this_ptr_conv.is_owned = false;
28986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28987 // WARNING: This object doesn't live past this scope, needs clone!
28988 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
28992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28993 LDKChannelManagerReadArgs this_ptr_conv;
28994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28995 this_ptr_conv.is_owned = false;
28996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28997 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28998 CHECK_ACCESS(val_ptr);
28999 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
29000 if (val_conv.free == LDKKeysInterface_JCalls_free) {
29001 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29002 LDKKeysInterface_JCalls_cloned(&val_conv);
29004 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
29007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
29008 LDKChannelManagerReadArgs this_ptr_conv;
29009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29010 this_ptr_conv.is_owned = false;
29011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29012 // WARNING: This object doesn't live past this scope, needs clone!
29013 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
29017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29018 LDKChannelManagerReadArgs this_ptr_conv;
29019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29020 this_ptr_conv.is_owned = false;
29021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29022 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29023 CHECK_ACCESS(val_ptr);
29024 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29025 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29026 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29027 LDKFeeEstimator_JCalls_cloned(&val_conv);
29029 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
29033 LDKChannelManagerReadArgs this_ptr_conv;
29034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29035 this_ptr_conv.is_owned = false;
29036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29037 // WARNING: This object doesn't live past this scope, needs clone!
29038 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
29042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29043 LDKChannelManagerReadArgs this_ptr_conv;
29044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29045 this_ptr_conv.is_owned = false;
29046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29047 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29048 CHECK_ACCESS(val_ptr);
29049 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29050 if (val_conv.free == LDKWatch_JCalls_free) {
29051 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29052 LDKWatch_JCalls_cloned(&val_conv);
29054 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
29058 LDKChannelManagerReadArgs this_ptr_conv;
29059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29060 this_ptr_conv.is_owned = false;
29061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29062 // WARNING: This object doesn't live past this scope, needs clone!
29063 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
29067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29068 LDKChannelManagerReadArgs this_ptr_conv;
29069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29070 this_ptr_conv.is_owned = false;
29071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29072 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29073 CHECK_ACCESS(val_ptr);
29074 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29075 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29076 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29077 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29079 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
29083 LDKChannelManagerReadArgs this_ptr_conv;
29084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29085 this_ptr_conv.is_owned = false;
29086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29087 // WARNING: This object doesn't live past this scope, needs clone!
29088 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
29092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29093 LDKChannelManagerReadArgs this_ptr_conv;
29094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29095 this_ptr_conv.is_owned = false;
29096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29097 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29098 CHECK_ACCESS(val_ptr);
29099 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
29100 if (val_conv.free == LDKLogger_JCalls_free) {
29101 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29102 LDKLogger_JCalls_cloned(&val_conv);
29104 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
29107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
29108 LDKChannelManagerReadArgs this_ptr_conv;
29109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29110 this_ptr_conv.is_owned = false;
29111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29112 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
29113 uintptr_t ret_ref = 0;
29114 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29115 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29117 ret_ref = (uintptr_t)ret_var.inner;
29118 if (ret_var.is_owned) {
29124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29125 LDKChannelManagerReadArgs this_ptr_conv;
29126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29127 this_ptr_conv.is_owned = false;
29128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29129 LDKUserConfig val_conv;
29130 val_conv.inner = (void*)(val & (~1));
29131 val_conv.is_owned = (val & 1) || (val == 0);
29132 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29133 val_conv = UserConfig_clone(&val_conv);
29134 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
29137 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) {
29138 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
29139 CHECK_ACCESS(keys_manager_ptr);
29140 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29141 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29142 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29143 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29145 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
29146 CHECK_ACCESS(fee_estimator_ptr);
29147 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29148 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29149 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29150 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29152 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
29153 CHECK_ACCESS(chain_monitor_ptr);
29154 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29155 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29156 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29157 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29159 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
29160 CHECK_ACCESS(tx_broadcaster_ptr);
29161 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29162 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29163 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29164 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29166 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
29167 CHECK_ACCESS(logger_ptr);
29168 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29169 if (logger_conv.free == LDKLogger_JCalls_free) {
29170 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29171 LDKLogger_JCalls_cloned(&logger_conv);
29173 LDKUserConfig default_config_conv;
29174 default_config_conv.inner = (void*)(default_config & (~1));
29175 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
29176 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
29177 default_config_conv = UserConfig_clone(&default_config_conv);
29178 LDKCVec_ChannelMonitorZ channel_monitors_constr;
29179 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
29180 if (channel_monitors_constr.datalen > 0)
29181 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
29183 channel_monitors_constr.data = NULL;
29184 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
29185 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
29186 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
29187 LDKChannelMonitor channel_monitors_conv_16_conv;
29188 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
29189 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
29190 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
29191 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
29193 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
29194 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);
29195 uintptr_t ret_ref = 0;
29196 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29197 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29199 ret_ref = (uintptr_t)ret_var.inner;
29200 if (ret_var.is_owned) {
29206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
29207 LDKu8slice ser_ref;
29208 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29209 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29210 LDKChannelManagerReadArgs arg_conv;
29211 arg_conv.inner = (void*)(arg & (~1));
29212 arg_conv.is_owned = (arg & 1) || (arg == 0);
29213 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29214 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
29215 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
29216 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
29217 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29218 return (uintptr_t)ret_conv;
29221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29222 LDKDecodeError this_obj_conv;
29223 this_obj_conv.inner = (void*)(this_obj & (~1));
29224 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29226 DecodeError_free(this_obj_conv);
29229 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
29230 LDKDecodeError ret_var = DecodeError_clone(arg);
29231 uintptr_t ret_ref = 0;
29232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29235 ret_ref = (uintptr_t)ret_var.inner;
29236 if (ret_var.is_owned) {
29241 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29242 LDKDecodeError arg_conv;
29243 arg_conv.inner = (void*)(arg & (~1));
29244 arg_conv.is_owned = false;
29245 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29246 intptr_t ret_val = DecodeError_clone_ptr(&arg_conv);
29250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29251 LDKDecodeError orig_conv;
29252 orig_conv.inner = (void*)(orig & (~1));
29253 orig_conv.is_owned = false;
29254 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29255 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
29256 uintptr_t ret_ref = 0;
29257 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29258 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29260 ret_ref = (uintptr_t)ret_var.inner;
29261 if (ret_var.is_owned) {
29267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29268 LDKInit this_obj_conv;
29269 this_obj_conv.inner = (void*)(this_obj & (~1));
29270 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29272 Init_free(this_obj_conv);
29275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29276 LDKInit this_ptr_conv;
29277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29278 this_ptr_conv.is_owned = false;
29279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29280 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
29281 uintptr_t ret_ref = 0;
29282 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29283 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29284 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29285 ret_ref = (uintptr_t)ret_var.inner;
29286 if (ret_var.is_owned) {
29292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29293 LDKInit this_ptr_conv;
29294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29295 this_ptr_conv.is_owned = false;
29296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29297 LDKInitFeatures val_conv;
29298 val_conv.inner = (void*)(val & (~1));
29299 val_conv.is_owned = (val & 1) || (val == 0);
29300 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29301 val_conv = InitFeatures_clone(&val_conv);
29302 Init_set_features(&this_ptr_conv, val_conv);
29305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
29306 LDKInitFeatures features_arg_conv;
29307 features_arg_conv.inner = (void*)(features_arg & (~1));
29308 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
29309 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
29310 features_arg_conv = InitFeatures_clone(&features_arg_conv);
29311 LDKInit ret_var = Init_new(features_arg_conv);
29312 uintptr_t ret_ref = 0;
29313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29316 ret_ref = (uintptr_t)ret_var.inner;
29317 if (ret_var.is_owned) {
29323 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
29324 LDKInit ret_var = Init_clone(arg);
29325 uintptr_t ret_ref = 0;
29326 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29327 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29329 ret_ref = (uintptr_t)ret_var.inner;
29330 if (ret_var.is_owned) {
29335 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29337 arg_conv.inner = (void*)(arg & (~1));
29338 arg_conv.is_owned = false;
29339 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29340 intptr_t ret_val = Init_clone_ptr(&arg_conv);
29344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29346 orig_conv.inner = (void*)(orig & (~1));
29347 orig_conv.is_owned = false;
29348 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29349 LDKInit ret_var = Init_clone(&orig_conv);
29350 uintptr_t ret_ref = 0;
29351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29354 ret_ref = (uintptr_t)ret_var.inner;
29355 if (ret_var.is_owned) {
29361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29362 LDKErrorMessage this_obj_conv;
29363 this_obj_conv.inner = (void*)(this_obj & (~1));
29364 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29366 ErrorMessage_free(this_obj_conv);
29369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29370 LDKErrorMessage this_ptr_conv;
29371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29372 this_ptr_conv.is_owned = false;
29373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29374 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29375 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
29379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29380 LDKErrorMessage this_ptr_conv;
29381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29382 this_ptr_conv.is_owned = false;
29383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29384 LDKThirtyTwoBytes val_ref;
29385 CHECK((*env)->GetArrayLength(env, val) == 32);
29386 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29387 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
29390 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
29391 LDKErrorMessage this_ptr_conv;
29392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29393 this_ptr_conv.is_owned = false;
29394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29395 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
29396 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
29402 LDKErrorMessage this_ptr_conv;
29403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29404 this_ptr_conv.is_owned = false;
29405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29406 LDKStr val_conv = java_to_owned_str(env, val);
29407 ErrorMessage_set_data(&this_ptr_conv, val_conv);
29410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
29411 LDKThirtyTwoBytes channel_id_arg_ref;
29412 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29413 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29414 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
29415 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
29416 uintptr_t ret_ref = 0;
29417 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29418 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29420 ret_ref = (uintptr_t)ret_var.inner;
29421 if (ret_var.is_owned) {
29427 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
29428 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
29429 uintptr_t ret_ref = 0;
29430 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29431 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29432 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29433 ret_ref = (uintptr_t)ret_var.inner;
29434 if (ret_var.is_owned) {
29439 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29440 LDKErrorMessage arg_conv;
29441 arg_conv.inner = (void*)(arg & (~1));
29442 arg_conv.is_owned = false;
29443 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29444 intptr_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
29448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29449 LDKErrorMessage orig_conv;
29450 orig_conv.inner = (void*)(orig & (~1));
29451 orig_conv.is_owned = false;
29452 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29453 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
29454 uintptr_t ret_ref = 0;
29455 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29456 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29457 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29458 ret_ref = (uintptr_t)ret_var.inner;
29459 if (ret_var.is_owned) {
29465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29466 LDKWarningMessage this_obj_conv;
29467 this_obj_conv.inner = (void*)(this_obj & (~1));
29468 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29470 WarningMessage_free(this_obj_conv);
29473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29474 LDKWarningMessage this_ptr_conv;
29475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29476 this_ptr_conv.is_owned = false;
29477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29478 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29479 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
29483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29484 LDKWarningMessage this_ptr_conv;
29485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29486 this_ptr_conv.is_owned = false;
29487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29488 LDKThirtyTwoBytes val_ref;
29489 CHECK((*env)->GetArrayLength(env, val) == 32);
29490 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29491 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
29494 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
29495 LDKWarningMessage this_ptr_conv;
29496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29497 this_ptr_conv.is_owned = false;
29498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29499 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
29500 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
29506 LDKWarningMessage this_ptr_conv;
29507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29508 this_ptr_conv.is_owned = false;
29509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29510 LDKStr val_conv = java_to_owned_str(env, val);
29511 WarningMessage_set_data(&this_ptr_conv, val_conv);
29514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
29515 LDKThirtyTwoBytes channel_id_arg_ref;
29516 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29517 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29518 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
29519 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
29520 uintptr_t ret_ref = 0;
29521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29524 ret_ref = (uintptr_t)ret_var.inner;
29525 if (ret_var.is_owned) {
29531 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
29532 LDKWarningMessage ret_var = WarningMessage_clone(arg);
29533 uintptr_t ret_ref = 0;
29534 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29535 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29536 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29537 ret_ref = (uintptr_t)ret_var.inner;
29538 if (ret_var.is_owned) {
29543 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29544 LDKWarningMessage arg_conv;
29545 arg_conv.inner = (void*)(arg & (~1));
29546 arg_conv.is_owned = false;
29547 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29548 intptr_t ret_val = WarningMessage_clone_ptr(&arg_conv);
29552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29553 LDKWarningMessage orig_conv;
29554 orig_conv.inner = (void*)(orig & (~1));
29555 orig_conv.is_owned = false;
29556 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29557 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
29558 uintptr_t ret_ref = 0;
29559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29562 ret_ref = (uintptr_t)ret_var.inner;
29563 if (ret_var.is_owned) {
29569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29570 LDKPing this_obj_conv;
29571 this_obj_conv.inner = (void*)(this_obj & (~1));
29572 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29574 Ping_free(this_obj_conv);
29577 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
29578 LDKPing this_ptr_conv;
29579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29580 this_ptr_conv.is_owned = false;
29581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29582 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
29586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29587 LDKPing this_ptr_conv;
29588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29589 this_ptr_conv.is_owned = false;
29590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29591 Ping_set_ponglen(&this_ptr_conv, val);
29594 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
29595 LDKPing this_ptr_conv;
29596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29597 this_ptr_conv.is_owned = false;
29598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29599 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
29603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29604 LDKPing this_ptr_conv;
29605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29606 this_ptr_conv.is_owned = false;
29607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29608 Ping_set_byteslen(&this_ptr_conv, val);
29611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
29612 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
29613 uintptr_t ret_ref = 0;
29614 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29615 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29617 ret_ref = (uintptr_t)ret_var.inner;
29618 if (ret_var.is_owned) {
29624 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
29625 LDKPing ret_var = Ping_clone(arg);
29626 uintptr_t ret_ref = 0;
29627 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29628 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29630 ret_ref = (uintptr_t)ret_var.inner;
29631 if (ret_var.is_owned) {
29636 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29638 arg_conv.inner = (void*)(arg & (~1));
29639 arg_conv.is_owned = false;
29640 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29641 intptr_t ret_val = Ping_clone_ptr(&arg_conv);
29645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29647 orig_conv.inner = (void*)(orig & (~1));
29648 orig_conv.is_owned = false;
29649 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29650 LDKPing ret_var = Ping_clone(&orig_conv);
29651 uintptr_t ret_ref = 0;
29652 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29653 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29655 ret_ref = (uintptr_t)ret_var.inner;
29656 if (ret_var.is_owned) {
29662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29663 LDKPong this_obj_conv;
29664 this_obj_conv.inner = (void*)(this_obj & (~1));
29665 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29667 Pong_free(this_obj_conv);
29670 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
29671 LDKPong this_ptr_conv;
29672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29673 this_ptr_conv.is_owned = false;
29674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29675 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
29679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29680 LDKPong this_ptr_conv;
29681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29682 this_ptr_conv.is_owned = false;
29683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29684 Pong_set_byteslen(&this_ptr_conv, val);
29687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
29688 LDKPong ret_var = Pong_new(byteslen_arg);
29689 uintptr_t ret_ref = 0;
29690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29693 ret_ref = (uintptr_t)ret_var.inner;
29694 if (ret_var.is_owned) {
29700 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
29701 LDKPong ret_var = Pong_clone(arg);
29702 uintptr_t ret_ref = 0;
29703 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29704 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29706 ret_ref = (uintptr_t)ret_var.inner;
29707 if (ret_var.is_owned) {
29712 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29714 arg_conv.inner = (void*)(arg & (~1));
29715 arg_conv.is_owned = false;
29716 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29717 intptr_t ret_val = Pong_clone_ptr(&arg_conv);
29721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29723 orig_conv.inner = (void*)(orig & (~1));
29724 orig_conv.is_owned = false;
29725 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29726 LDKPong ret_var = Pong_clone(&orig_conv);
29727 uintptr_t ret_ref = 0;
29728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29731 ret_ref = (uintptr_t)ret_var.inner;
29732 if (ret_var.is_owned) {
29738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29739 LDKOpenChannel this_obj_conv;
29740 this_obj_conv.inner = (void*)(this_obj & (~1));
29741 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29743 OpenChannel_free(this_obj_conv);
29746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
29747 LDKOpenChannel this_ptr_conv;
29748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29749 this_ptr_conv.is_owned = false;
29750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29751 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29752 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
29756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29757 LDKOpenChannel this_ptr_conv;
29758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29759 this_ptr_conv.is_owned = false;
29760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29761 LDKThirtyTwoBytes val_ref;
29762 CHECK((*env)->GetArrayLength(env, val) == 32);
29763 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29764 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
29767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29768 LDKOpenChannel this_ptr_conv;
29769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29770 this_ptr_conv.is_owned = false;
29771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29772 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29773 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
29777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29778 LDKOpenChannel this_ptr_conv;
29779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29780 this_ptr_conv.is_owned = false;
29781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29782 LDKThirtyTwoBytes val_ref;
29783 CHECK((*env)->GetArrayLength(env, val) == 32);
29784 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29785 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
29788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29789 LDKOpenChannel this_ptr_conv;
29790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29791 this_ptr_conv.is_owned = false;
29792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29793 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
29797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29798 LDKOpenChannel this_ptr_conv;
29799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29800 this_ptr_conv.is_owned = false;
29801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29802 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
29805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29806 LDKOpenChannel this_ptr_conv;
29807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29808 this_ptr_conv.is_owned = false;
29809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29810 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
29814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29815 LDKOpenChannel this_ptr_conv;
29816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29817 this_ptr_conv.is_owned = false;
29818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29819 OpenChannel_set_push_msat(&this_ptr_conv, val);
29822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29823 LDKOpenChannel this_ptr_conv;
29824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29825 this_ptr_conv.is_owned = false;
29826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29827 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
29831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29832 LDKOpenChannel this_ptr_conv;
29833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29834 this_ptr_conv.is_owned = false;
29835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29836 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
29839 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) {
29840 LDKOpenChannel this_ptr_conv;
29841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29842 this_ptr_conv.is_owned = false;
29843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29844 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
29848 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) {
29849 LDKOpenChannel this_ptr_conv;
29850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29851 this_ptr_conv.is_owned = false;
29852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29853 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
29856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29857 LDKOpenChannel this_ptr_conv;
29858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29859 this_ptr_conv.is_owned = false;
29860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29861 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
29865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29866 LDKOpenChannel this_ptr_conv;
29867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29868 this_ptr_conv.is_owned = false;
29869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29870 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
29873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29874 LDKOpenChannel this_ptr_conv;
29875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29876 this_ptr_conv.is_owned = false;
29877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29878 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
29882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29883 LDKOpenChannel this_ptr_conv;
29884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29885 this_ptr_conv.is_owned = false;
29886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29887 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
29890 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
29891 LDKOpenChannel this_ptr_conv;
29892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29893 this_ptr_conv.is_owned = false;
29894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29895 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
29899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29900 LDKOpenChannel this_ptr_conv;
29901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29902 this_ptr_conv.is_owned = false;
29903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29904 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
29907 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
29908 LDKOpenChannel this_ptr_conv;
29909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29910 this_ptr_conv.is_owned = false;
29911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29912 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
29916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29917 LDKOpenChannel this_ptr_conv;
29918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29919 this_ptr_conv.is_owned = false;
29920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29921 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
29924 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
29925 LDKOpenChannel 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 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
29933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29934 LDKOpenChannel this_ptr_conv;
29935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29936 this_ptr_conv.is_owned = false;
29937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29938 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
29941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
29942 LDKOpenChannel this_ptr_conv;
29943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29944 this_ptr_conv.is_owned = false;
29945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29946 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29947 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
29951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29952 LDKOpenChannel this_ptr_conv;
29953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29954 this_ptr_conv.is_owned = false;
29955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29956 LDKPublicKey val_ref;
29957 CHECK((*env)->GetArrayLength(env, val) == 33);
29958 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29959 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
29962 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
29963 LDKOpenChannel this_ptr_conv;
29964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29965 this_ptr_conv.is_owned = false;
29966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29967 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29968 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
29972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29973 LDKOpenChannel this_ptr_conv;
29974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29975 this_ptr_conv.is_owned = false;
29976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29977 LDKPublicKey val_ref;
29978 CHECK((*env)->GetArrayLength(env, val) == 33);
29979 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29980 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
29983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
29984 LDKOpenChannel this_ptr_conv;
29985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29986 this_ptr_conv.is_owned = false;
29987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29988 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29989 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
29993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29994 LDKOpenChannel this_ptr_conv;
29995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29996 this_ptr_conv.is_owned = false;
29997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29998 LDKPublicKey val_ref;
29999 CHECK((*env)->GetArrayLength(env, val) == 33);
30000 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30001 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
30004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30005 LDKOpenChannel this_ptr_conv;
30006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30007 this_ptr_conv.is_owned = false;
30008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30009 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30010 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
30014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30015 LDKOpenChannel this_ptr_conv;
30016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30017 this_ptr_conv.is_owned = false;
30018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30019 LDKPublicKey val_ref;
30020 CHECK((*env)->GetArrayLength(env, val) == 33);
30021 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30022 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
30025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30026 LDKOpenChannel this_ptr_conv;
30027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30028 this_ptr_conv.is_owned = false;
30029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30030 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30031 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
30035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30036 LDKOpenChannel this_ptr_conv;
30037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30038 this_ptr_conv.is_owned = false;
30039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30040 LDKPublicKey val_ref;
30041 CHECK((*env)->GetArrayLength(env, val) == 33);
30042 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30043 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
30046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30047 LDKOpenChannel this_ptr_conv;
30048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30049 this_ptr_conv.is_owned = false;
30050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30051 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30052 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
30056 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) {
30057 LDKOpenChannel this_ptr_conv;
30058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30059 this_ptr_conv.is_owned = false;
30060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30061 LDKPublicKey val_ref;
30062 CHECK((*env)->GetArrayLength(env, val) == 33);
30063 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30064 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
30067 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
30068 LDKOpenChannel this_ptr_conv;
30069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30070 this_ptr_conv.is_owned = false;
30071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30072 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
30076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
30077 LDKOpenChannel this_ptr_conv;
30078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30079 this_ptr_conv.is_owned = false;
30080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30081 OpenChannel_set_channel_flags(&this_ptr_conv, val);
30084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
30085 LDKOpenChannel this_ptr_conv;
30086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30087 this_ptr_conv.is_owned = false;
30088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30089 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
30090 uintptr_t ret_ref = 0;
30091 if ((uintptr_t)ret_var.inner > 4096) {
30092 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30093 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30095 ret_ref = (uintptr_t)ret_var.inner;
30096 if (ret_var.is_owned) {
30103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30104 LDKOpenChannel this_ptr_conv;
30105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30106 this_ptr_conv.is_owned = false;
30107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30108 LDKChannelTypeFeatures val_conv;
30109 val_conv.inner = (void*)(val & (~1));
30110 val_conv.is_owned = (val & 1) || (val == 0);
30111 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30112 val_conv = ChannelTypeFeatures_clone(&val_conv);
30113 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
30116 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
30117 LDKOpenChannel ret_var = OpenChannel_clone(arg);
30118 uintptr_t ret_ref = 0;
30119 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30120 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30122 ret_ref = (uintptr_t)ret_var.inner;
30123 if (ret_var.is_owned) {
30128 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30129 LDKOpenChannel arg_conv;
30130 arg_conv.inner = (void*)(arg & (~1));
30131 arg_conv.is_owned = false;
30132 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30133 intptr_t ret_val = OpenChannel_clone_ptr(&arg_conv);
30137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30138 LDKOpenChannel orig_conv;
30139 orig_conv.inner = (void*)(orig & (~1));
30140 orig_conv.is_owned = false;
30141 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30142 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
30143 uintptr_t ret_ref = 0;
30144 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30145 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30147 ret_ref = (uintptr_t)ret_var.inner;
30148 if (ret_var.is_owned) {
30154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30155 LDKAcceptChannel this_obj_conv;
30156 this_obj_conv.inner = (void*)(this_obj & (~1));
30157 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30159 AcceptChannel_free(this_obj_conv);
30162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30163 LDKAcceptChannel this_ptr_conv;
30164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30165 this_ptr_conv.is_owned = false;
30166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30167 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30168 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
30172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30173 LDKAcceptChannel this_ptr_conv;
30174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30175 this_ptr_conv.is_owned = false;
30176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30177 LDKThirtyTwoBytes val_ref;
30178 CHECK((*env)->GetArrayLength(env, val) == 32);
30179 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30180 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30184 LDKAcceptChannel this_ptr_conv;
30185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30186 this_ptr_conv.is_owned = false;
30187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30188 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
30192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30193 LDKAcceptChannel this_ptr_conv;
30194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30195 this_ptr_conv.is_owned = false;
30196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30197 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30200 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) {
30201 LDKAcceptChannel this_ptr_conv;
30202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30203 this_ptr_conv.is_owned = false;
30204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30205 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30209 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) {
30210 LDKAcceptChannel this_ptr_conv;
30211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30212 this_ptr_conv.is_owned = false;
30213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30214 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30218 LDKAcceptChannel 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 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30227 LDKAcceptChannel 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 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30235 LDKAcceptChannel this_ptr_conv;
30236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30237 this_ptr_conv.is_owned = false;
30238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30239 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
30243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30244 LDKAcceptChannel this_ptr_conv;
30245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30246 this_ptr_conv.is_owned = false;
30247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30248 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30251 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
30252 LDKAcceptChannel this_ptr_conv;
30253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30254 this_ptr_conv.is_owned = false;
30255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30256 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
30260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30261 LDKAcceptChannel this_ptr_conv;
30262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30263 this_ptr_conv.is_owned = false;
30264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30265 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
30268 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30269 LDKAcceptChannel this_ptr_conv;
30270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30271 this_ptr_conv.is_owned = false;
30272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30273 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
30277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30278 LDKAcceptChannel this_ptr_conv;
30279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30280 this_ptr_conv.is_owned = false;
30281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30282 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
30285 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
30286 LDKAcceptChannel this_ptr_conv;
30287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30288 this_ptr_conv.is_owned = false;
30289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30290 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
30294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30295 LDKAcceptChannel this_ptr_conv;
30296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30297 this_ptr_conv.is_owned = false;
30298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30299 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30302 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30303 LDKAcceptChannel this_ptr_conv;
30304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30305 this_ptr_conv.is_owned = false;
30306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30307 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30308 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
30312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30313 LDKAcceptChannel this_ptr_conv;
30314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30315 this_ptr_conv.is_owned = false;
30316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30317 LDKPublicKey val_ref;
30318 CHECK((*env)->GetArrayLength(env, val) == 33);
30319 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30320 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30324 LDKAcceptChannel this_ptr_conv;
30325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30326 this_ptr_conv.is_owned = false;
30327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30328 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30329 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
30333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30334 LDKAcceptChannel this_ptr_conv;
30335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30336 this_ptr_conv.is_owned = false;
30337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30338 LDKPublicKey val_ref;
30339 CHECK((*env)->GetArrayLength(env, val) == 33);
30340 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30341 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30345 LDKAcceptChannel this_ptr_conv;
30346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30347 this_ptr_conv.is_owned = false;
30348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30349 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30350 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
30354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30355 LDKAcceptChannel this_ptr_conv;
30356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30357 this_ptr_conv.is_owned = false;
30358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30359 LDKPublicKey val_ref;
30360 CHECK((*env)->GetArrayLength(env, val) == 33);
30361 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30362 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
30365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30366 LDKAcceptChannel this_ptr_conv;
30367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30368 this_ptr_conv.is_owned = false;
30369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30370 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30371 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
30375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30376 LDKAcceptChannel this_ptr_conv;
30377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30378 this_ptr_conv.is_owned = false;
30379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30380 LDKPublicKey val_ref;
30381 CHECK((*env)->GetArrayLength(env, val) == 33);
30382 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30383 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
30386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30387 LDKAcceptChannel this_ptr_conv;
30388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30389 this_ptr_conv.is_owned = false;
30390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30391 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30392 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
30396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30397 LDKAcceptChannel this_ptr_conv;
30398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30399 this_ptr_conv.is_owned = false;
30400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30401 LDKPublicKey val_ref;
30402 CHECK((*env)->GetArrayLength(env, val) == 33);
30403 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30404 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
30407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30408 LDKAcceptChannel this_ptr_conv;
30409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30410 this_ptr_conv.is_owned = false;
30411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30412 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30413 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
30417 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) {
30418 LDKAcceptChannel this_ptr_conv;
30419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30420 this_ptr_conv.is_owned = false;
30421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30422 LDKPublicKey val_ref;
30423 CHECK((*env)->GetArrayLength(env, val) == 33);
30424 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30425 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
30428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
30429 LDKAcceptChannel this_ptr_conv;
30430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30431 this_ptr_conv.is_owned = false;
30432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30433 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
30434 uintptr_t ret_ref = 0;
30435 if ((uintptr_t)ret_var.inner > 4096) {
30436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30439 ret_ref = (uintptr_t)ret_var.inner;
30440 if (ret_var.is_owned) {
30447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30448 LDKAcceptChannel this_ptr_conv;
30449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30450 this_ptr_conv.is_owned = false;
30451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30452 LDKChannelTypeFeatures val_conv;
30453 val_conv.inner = (void*)(val & (~1));
30454 val_conv.is_owned = (val & 1) || (val == 0);
30455 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30456 val_conv = ChannelTypeFeatures_clone(&val_conv);
30457 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
30460 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
30461 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
30462 uintptr_t ret_ref = 0;
30463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30466 ret_ref = (uintptr_t)ret_var.inner;
30467 if (ret_var.is_owned) {
30472 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30473 LDKAcceptChannel arg_conv;
30474 arg_conv.inner = (void*)(arg & (~1));
30475 arg_conv.is_owned = false;
30476 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30477 intptr_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
30481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30482 LDKAcceptChannel orig_conv;
30483 orig_conv.inner = (void*)(orig & (~1));
30484 orig_conv.is_owned = false;
30485 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30486 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
30487 uintptr_t ret_ref = 0;
30488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30491 ret_ref = (uintptr_t)ret_var.inner;
30492 if (ret_var.is_owned) {
30498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30499 LDKFundingCreated this_obj_conv;
30500 this_obj_conv.inner = (void*)(this_obj & (~1));
30501 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30503 FundingCreated_free(this_obj_conv);
30506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30507 LDKFundingCreated this_ptr_conv;
30508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30509 this_ptr_conv.is_owned = false;
30510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30511 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30512 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
30516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30517 LDKFundingCreated this_ptr_conv;
30518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30519 this_ptr_conv.is_owned = false;
30520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30521 LDKThirtyTwoBytes val_ref;
30522 CHECK((*env)->GetArrayLength(env, val) == 32);
30523 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30524 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
30527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
30528 LDKFundingCreated this_ptr_conv;
30529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30530 this_ptr_conv.is_owned = false;
30531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30532 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30533 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
30537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30538 LDKFundingCreated this_ptr_conv;
30539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30540 this_ptr_conv.is_owned = false;
30541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30542 LDKThirtyTwoBytes val_ref;
30543 CHECK((*env)->GetArrayLength(env, val) == 32);
30544 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30545 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
30548 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
30549 LDKFundingCreated this_ptr_conv;
30550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30551 this_ptr_conv.is_owned = false;
30552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30553 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
30557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30558 LDKFundingCreated this_ptr_conv;
30559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30560 this_ptr_conv.is_owned = false;
30561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30562 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
30565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
30566 LDKFundingCreated this_ptr_conv;
30567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30568 this_ptr_conv.is_owned = false;
30569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30570 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
30571 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
30575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30576 LDKFundingCreated this_ptr_conv;
30577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30578 this_ptr_conv.is_owned = false;
30579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30580 LDKSignature val_ref;
30581 CHECK((*env)->GetArrayLength(env, val) == 64);
30582 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
30583 FundingCreated_set_signature(&this_ptr_conv, val_ref);
30586 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) {
30587 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
30588 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
30589 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
30590 LDKThirtyTwoBytes funding_txid_arg_ref;
30591 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
30592 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
30593 LDKSignature signature_arg_ref;
30594 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
30595 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
30596 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
30597 uintptr_t ret_ref = 0;
30598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30601 ret_ref = (uintptr_t)ret_var.inner;
30602 if (ret_var.is_owned) {
30608 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
30609 LDKFundingCreated ret_var = FundingCreated_clone(arg);
30610 uintptr_t ret_ref = 0;
30611 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30612 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30613 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30614 ret_ref = (uintptr_t)ret_var.inner;
30615 if (ret_var.is_owned) {
30620 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30621 LDKFundingCreated arg_conv;
30622 arg_conv.inner = (void*)(arg & (~1));
30623 arg_conv.is_owned = false;
30624 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30625 intptr_t ret_val = FundingCreated_clone_ptr(&arg_conv);
30629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30630 LDKFundingCreated orig_conv;
30631 orig_conv.inner = (void*)(orig & (~1));
30632 orig_conv.is_owned = false;
30633 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30634 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
30635 uintptr_t ret_ref = 0;
30636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30639 ret_ref = (uintptr_t)ret_var.inner;
30640 if (ret_var.is_owned) {
30646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30647 LDKFundingSigned this_obj_conv;
30648 this_obj_conv.inner = (void*)(this_obj & (~1));
30649 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30651 FundingSigned_free(this_obj_conv);
30654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30655 LDKFundingSigned this_ptr_conv;
30656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30657 this_ptr_conv.is_owned = false;
30658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30659 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30660 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
30664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30665 LDKFundingSigned this_ptr_conv;
30666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30667 this_ptr_conv.is_owned = false;
30668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30669 LDKThirtyTwoBytes val_ref;
30670 CHECK((*env)->GetArrayLength(env, val) == 32);
30671 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30672 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
30675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
30676 LDKFundingSigned this_ptr_conv;
30677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30678 this_ptr_conv.is_owned = false;
30679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30680 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
30681 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
30685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30686 LDKFundingSigned this_ptr_conv;
30687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30688 this_ptr_conv.is_owned = false;
30689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30690 LDKSignature val_ref;
30691 CHECK((*env)->GetArrayLength(env, val) == 64);
30692 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
30693 FundingSigned_set_signature(&this_ptr_conv, val_ref);
30696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
30697 LDKThirtyTwoBytes channel_id_arg_ref;
30698 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30699 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30700 LDKSignature signature_arg_ref;
30701 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
30702 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
30703 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
30704 uintptr_t ret_ref = 0;
30705 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30706 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30708 ret_ref = (uintptr_t)ret_var.inner;
30709 if (ret_var.is_owned) {
30715 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
30716 LDKFundingSigned ret_var = FundingSigned_clone(arg);
30717 uintptr_t ret_ref = 0;
30718 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30719 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30721 ret_ref = (uintptr_t)ret_var.inner;
30722 if (ret_var.is_owned) {
30727 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30728 LDKFundingSigned arg_conv;
30729 arg_conv.inner = (void*)(arg & (~1));
30730 arg_conv.is_owned = false;
30731 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30732 intptr_t ret_val = FundingSigned_clone_ptr(&arg_conv);
30736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30737 LDKFundingSigned orig_conv;
30738 orig_conv.inner = (void*)(orig & (~1));
30739 orig_conv.is_owned = false;
30740 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30741 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
30742 uintptr_t ret_ref = 0;
30743 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30744 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30745 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30746 ret_ref = (uintptr_t)ret_var.inner;
30747 if (ret_var.is_owned) {
30753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30754 LDKFundingLocked this_obj_conv;
30755 this_obj_conv.inner = (void*)(this_obj & (~1));
30756 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30758 FundingLocked_free(this_obj_conv);
30761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30762 LDKFundingLocked this_ptr_conv;
30763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30764 this_ptr_conv.is_owned = false;
30765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30766 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30767 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
30771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30772 LDKFundingLocked this_ptr_conv;
30773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30774 this_ptr_conv.is_owned = false;
30775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30776 LDKThirtyTwoBytes val_ref;
30777 CHECK((*env)->GetArrayLength(env, val) == 32);
30778 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30779 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
30782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30783 LDKFundingLocked this_ptr_conv;
30784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30785 this_ptr_conv.is_owned = false;
30786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30787 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30788 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
30792 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) {
30793 LDKFundingLocked this_ptr_conv;
30794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30795 this_ptr_conv.is_owned = false;
30796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30797 LDKPublicKey val_ref;
30798 CHECK((*env)->GetArrayLength(env, val) == 33);
30799 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30800 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
30803 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) {
30804 LDKThirtyTwoBytes channel_id_arg_ref;
30805 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30806 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30807 LDKPublicKey next_per_commitment_point_arg_ref;
30808 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
30809 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
30810 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
30811 uintptr_t ret_ref = 0;
30812 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30813 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30815 ret_ref = (uintptr_t)ret_var.inner;
30816 if (ret_var.is_owned) {
30822 static inline uintptr_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
30823 LDKFundingLocked ret_var = FundingLocked_clone(arg);
30824 uintptr_t ret_ref = 0;
30825 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30826 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30828 ret_ref = (uintptr_t)ret_var.inner;
30829 if (ret_var.is_owned) {
30834 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30835 LDKFundingLocked arg_conv;
30836 arg_conv.inner = (void*)(arg & (~1));
30837 arg_conv.is_owned = false;
30838 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30839 intptr_t ret_val = FundingLocked_clone_ptr(&arg_conv);
30843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30844 LDKFundingLocked orig_conv;
30845 orig_conv.inner = (void*)(orig & (~1));
30846 orig_conv.is_owned = false;
30847 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30848 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
30849 uintptr_t ret_ref = 0;
30850 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30851 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30853 ret_ref = (uintptr_t)ret_var.inner;
30854 if (ret_var.is_owned) {
30860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30861 LDKShutdown this_obj_conv;
30862 this_obj_conv.inner = (void*)(this_obj & (~1));
30863 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30865 Shutdown_free(this_obj_conv);
30868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30869 LDKShutdown this_ptr_conv;
30870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30871 this_ptr_conv.is_owned = false;
30872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30873 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30874 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
30878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30879 LDKShutdown this_ptr_conv;
30880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30881 this_ptr_conv.is_owned = false;
30882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30883 LDKThirtyTwoBytes val_ref;
30884 CHECK((*env)->GetArrayLength(env, val) == 32);
30885 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30886 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
30889 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30890 LDKShutdown this_ptr_conv;
30891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30892 this_ptr_conv.is_owned = false;
30893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30894 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
30895 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30896 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30901 LDKShutdown this_ptr_conv;
30902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30903 this_ptr_conv.is_owned = false;
30904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30905 LDKCVec_u8Z val_ref;
30906 val_ref.datalen = (*env)->GetArrayLength(env, val);
30907 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
30908 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
30909 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
30912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
30913 LDKThirtyTwoBytes channel_id_arg_ref;
30914 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30915 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30916 LDKCVec_u8Z scriptpubkey_arg_ref;
30917 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
30918 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
30919 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
30920 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
30921 uintptr_t ret_ref = 0;
30922 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30923 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30924 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30925 ret_ref = (uintptr_t)ret_var.inner;
30926 if (ret_var.is_owned) {
30932 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
30933 LDKShutdown ret_var = Shutdown_clone(arg);
30934 uintptr_t ret_ref = 0;
30935 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30936 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30938 ret_ref = (uintptr_t)ret_var.inner;
30939 if (ret_var.is_owned) {
30944 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30945 LDKShutdown arg_conv;
30946 arg_conv.inner = (void*)(arg & (~1));
30947 arg_conv.is_owned = false;
30948 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30949 intptr_t ret_val = Shutdown_clone_ptr(&arg_conv);
30953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30954 LDKShutdown orig_conv;
30955 orig_conv.inner = (void*)(orig & (~1));
30956 orig_conv.is_owned = false;
30957 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30958 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
30959 uintptr_t ret_ref = 0;
30960 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30961 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30963 ret_ref = (uintptr_t)ret_var.inner;
30964 if (ret_var.is_owned) {
30970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30971 LDKClosingSignedFeeRange this_obj_conv;
30972 this_obj_conv.inner = (void*)(this_obj & (~1));
30973 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30975 ClosingSignedFeeRange_free(this_obj_conv);
30978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30979 LDKClosingSignedFeeRange this_ptr_conv;
30980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30981 this_ptr_conv.is_owned = false;
30982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30983 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
30987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30988 LDKClosingSignedFeeRange this_ptr_conv;
30989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30990 this_ptr_conv.is_owned = false;
30991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30992 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
30995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30996 LDKClosingSignedFeeRange this_ptr_conv;
30997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30998 this_ptr_conv.is_owned = false;
30999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31000 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
31004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31005 LDKClosingSignedFeeRange this_ptr_conv;
31006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31007 this_ptr_conv.is_owned = false;
31008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31009 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
31012 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) {
31013 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
31014 uintptr_t ret_ref = 0;
31015 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31016 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31018 ret_ref = (uintptr_t)ret_var.inner;
31019 if (ret_var.is_owned) {
31025 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
31026 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
31027 uintptr_t ret_ref = 0;
31028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31031 ret_ref = (uintptr_t)ret_var.inner;
31032 if (ret_var.is_owned) {
31037 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31038 LDKClosingSignedFeeRange arg_conv;
31039 arg_conv.inner = (void*)(arg & (~1));
31040 arg_conv.is_owned = false;
31041 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31042 intptr_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
31046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31047 LDKClosingSignedFeeRange orig_conv;
31048 orig_conv.inner = (void*)(orig & (~1));
31049 orig_conv.is_owned = false;
31050 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31051 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
31052 uintptr_t ret_ref = 0;
31053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31056 ret_ref = (uintptr_t)ret_var.inner;
31057 if (ret_var.is_owned) {
31063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31064 LDKClosingSigned this_obj_conv;
31065 this_obj_conv.inner = (void*)(this_obj & (~1));
31066 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31068 ClosingSigned_free(this_obj_conv);
31071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31072 LDKClosingSigned this_ptr_conv;
31073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31074 this_ptr_conv.is_owned = false;
31075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31076 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31077 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
31081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31082 LDKClosingSigned this_ptr_conv;
31083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31084 this_ptr_conv.is_owned = false;
31085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31086 LDKThirtyTwoBytes val_ref;
31087 CHECK((*env)->GetArrayLength(env, val) == 32);
31088 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31089 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
31092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31093 LDKClosingSigned this_ptr_conv;
31094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31095 this_ptr_conv.is_owned = false;
31096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31097 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
31101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31102 LDKClosingSigned this_ptr_conv;
31103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31104 this_ptr_conv.is_owned = false;
31105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31106 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
31109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31110 LDKClosingSigned this_ptr_conv;
31111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31112 this_ptr_conv.is_owned = false;
31113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31114 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31115 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
31119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31120 LDKClosingSigned this_ptr_conv;
31121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31122 this_ptr_conv.is_owned = false;
31123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31124 LDKSignature val_ref;
31125 CHECK((*env)->GetArrayLength(env, val) == 64);
31126 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31127 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
31130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
31131 LDKClosingSigned this_ptr_conv;
31132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31133 this_ptr_conv.is_owned = false;
31134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31135 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
31136 uintptr_t ret_ref = 0;
31137 if ((uintptr_t)ret_var.inner > 4096) {
31138 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31139 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31141 ret_ref = (uintptr_t)ret_var.inner;
31142 if (ret_var.is_owned) {
31149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31150 LDKClosingSigned this_ptr_conv;
31151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31152 this_ptr_conv.is_owned = false;
31153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31154 LDKClosingSignedFeeRange val_conv;
31155 val_conv.inner = (void*)(val & (~1));
31156 val_conv.is_owned = (val & 1) || (val == 0);
31157 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31158 val_conv = ClosingSignedFeeRange_clone(&val_conv);
31159 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
31162 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) {
31163 LDKThirtyTwoBytes channel_id_arg_ref;
31164 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31165 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31166 LDKSignature signature_arg_ref;
31167 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31168 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31169 LDKClosingSignedFeeRange fee_range_arg_conv;
31170 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
31171 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
31172 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
31173 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
31174 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
31175 uintptr_t ret_ref = 0;
31176 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31177 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31179 ret_ref = (uintptr_t)ret_var.inner;
31180 if (ret_var.is_owned) {
31186 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
31187 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
31188 uintptr_t ret_ref = 0;
31189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31192 ret_ref = (uintptr_t)ret_var.inner;
31193 if (ret_var.is_owned) {
31198 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31199 LDKClosingSigned arg_conv;
31200 arg_conv.inner = (void*)(arg & (~1));
31201 arg_conv.is_owned = false;
31202 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31203 intptr_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
31207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31208 LDKClosingSigned orig_conv;
31209 orig_conv.inner = (void*)(orig & (~1));
31210 orig_conv.is_owned = false;
31211 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31212 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
31213 uintptr_t ret_ref = 0;
31214 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31215 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31217 ret_ref = (uintptr_t)ret_var.inner;
31218 if (ret_var.is_owned) {
31224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31225 LDKUpdateAddHTLC this_obj_conv;
31226 this_obj_conv.inner = (void*)(this_obj & (~1));
31227 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31229 UpdateAddHTLC_free(this_obj_conv);
31232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31233 LDKUpdateAddHTLC this_ptr_conv;
31234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31235 this_ptr_conv.is_owned = false;
31236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31237 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31238 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
31242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31243 LDKUpdateAddHTLC this_ptr_conv;
31244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31245 this_ptr_conv.is_owned = false;
31246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31247 LDKThirtyTwoBytes val_ref;
31248 CHECK((*env)->GetArrayLength(env, val) == 32);
31249 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31250 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
31253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31254 LDKUpdateAddHTLC this_ptr_conv;
31255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31256 this_ptr_conv.is_owned = false;
31257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31258 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
31262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31263 LDKUpdateAddHTLC this_ptr_conv;
31264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31265 this_ptr_conv.is_owned = false;
31266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31267 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
31270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31271 LDKUpdateAddHTLC this_ptr_conv;
31272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31273 this_ptr_conv.is_owned = false;
31274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31275 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
31279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31280 LDKUpdateAddHTLC this_ptr_conv;
31281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31282 this_ptr_conv.is_owned = false;
31283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31284 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
31287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31288 LDKUpdateAddHTLC this_ptr_conv;
31289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31290 this_ptr_conv.is_owned = false;
31291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31292 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31293 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
31297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31298 LDKUpdateAddHTLC this_ptr_conv;
31299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31300 this_ptr_conv.is_owned = false;
31301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31302 LDKThirtyTwoBytes val_ref;
31303 CHECK((*env)->GetArrayLength(env, val) == 32);
31304 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31305 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
31308 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
31309 LDKUpdateAddHTLC this_ptr_conv;
31310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31311 this_ptr_conv.is_owned = false;
31312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31313 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
31317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31318 LDKUpdateAddHTLC this_ptr_conv;
31319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31320 this_ptr_conv.is_owned = false;
31321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31322 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
31325 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
31326 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
31327 uintptr_t ret_ref = 0;
31328 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31329 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31331 ret_ref = (uintptr_t)ret_var.inner;
31332 if (ret_var.is_owned) {
31337 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31338 LDKUpdateAddHTLC arg_conv;
31339 arg_conv.inner = (void*)(arg & (~1));
31340 arg_conv.is_owned = false;
31341 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31342 intptr_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
31346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31347 LDKUpdateAddHTLC orig_conv;
31348 orig_conv.inner = (void*)(orig & (~1));
31349 orig_conv.is_owned = false;
31350 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31351 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
31352 uintptr_t ret_ref = 0;
31353 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31354 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31356 ret_ref = (uintptr_t)ret_var.inner;
31357 if (ret_var.is_owned) {
31363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31364 LDKUpdateFulfillHTLC this_obj_conv;
31365 this_obj_conv.inner = (void*)(this_obj & (~1));
31366 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31368 UpdateFulfillHTLC_free(this_obj_conv);
31371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31372 LDKUpdateFulfillHTLC this_ptr_conv;
31373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31374 this_ptr_conv.is_owned = false;
31375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31376 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31377 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
31381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31382 LDKUpdateFulfillHTLC this_ptr_conv;
31383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31384 this_ptr_conv.is_owned = false;
31385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31386 LDKThirtyTwoBytes val_ref;
31387 CHECK((*env)->GetArrayLength(env, val) == 32);
31388 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31389 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
31392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31393 LDKUpdateFulfillHTLC this_ptr_conv;
31394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31395 this_ptr_conv.is_owned = false;
31396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31397 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
31401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31402 LDKUpdateFulfillHTLC this_ptr_conv;
31403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31404 this_ptr_conv.is_owned = false;
31405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31406 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
31409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
31410 LDKUpdateFulfillHTLC this_ptr_conv;
31411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31412 this_ptr_conv.is_owned = false;
31413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31414 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31415 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
31419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31420 LDKUpdateFulfillHTLC this_ptr_conv;
31421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31422 this_ptr_conv.is_owned = false;
31423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31424 LDKThirtyTwoBytes val_ref;
31425 CHECK((*env)->GetArrayLength(env, val) == 32);
31426 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31427 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
31430 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) {
31431 LDKThirtyTwoBytes channel_id_arg_ref;
31432 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31433 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31434 LDKThirtyTwoBytes payment_preimage_arg_ref;
31435 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
31436 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
31437 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
31438 uintptr_t ret_ref = 0;
31439 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31440 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31442 ret_ref = (uintptr_t)ret_var.inner;
31443 if (ret_var.is_owned) {
31449 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
31450 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
31451 uintptr_t ret_ref = 0;
31452 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31453 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31455 ret_ref = (uintptr_t)ret_var.inner;
31456 if (ret_var.is_owned) {
31461 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31462 LDKUpdateFulfillHTLC arg_conv;
31463 arg_conv.inner = (void*)(arg & (~1));
31464 arg_conv.is_owned = false;
31465 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31466 intptr_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
31470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31471 LDKUpdateFulfillHTLC orig_conv;
31472 orig_conv.inner = (void*)(orig & (~1));
31473 orig_conv.is_owned = false;
31474 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31475 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
31476 uintptr_t ret_ref = 0;
31477 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31478 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31480 ret_ref = (uintptr_t)ret_var.inner;
31481 if (ret_var.is_owned) {
31487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31488 LDKUpdateFailHTLC this_obj_conv;
31489 this_obj_conv.inner = (void*)(this_obj & (~1));
31490 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31492 UpdateFailHTLC_free(this_obj_conv);
31495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31496 LDKUpdateFailHTLC this_ptr_conv;
31497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31498 this_ptr_conv.is_owned = false;
31499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31500 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31501 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
31505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31506 LDKUpdateFailHTLC this_ptr_conv;
31507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31508 this_ptr_conv.is_owned = false;
31509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31510 LDKThirtyTwoBytes val_ref;
31511 CHECK((*env)->GetArrayLength(env, val) == 32);
31512 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31513 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
31516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31517 LDKUpdateFailHTLC this_ptr_conv;
31518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31519 this_ptr_conv.is_owned = false;
31520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31521 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
31525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31526 LDKUpdateFailHTLC this_ptr_conv;
31527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31528 this_ptr_conv.is_owned = false;
31529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31530 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
31533 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
31534 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
31535 uintptr_t ret_ref = 0;
31536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31539 ret_ref = (uintptr_t)ret_var.inner;
31540 if (ret_var.is_owned) {
31545 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31546 LDKUpdateFailHTLC arg_conv;
31547 arg_conv.inner = (void*)(arg & (~1));
31548 arg_conv.is_owned = false;
31549 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31550 intptr_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
31554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31555 LDKUpdateFailHTLC orig_conv;
31556 orig_conv.inner = (void*)(orig & (~1));
31557 orig_conv.is_owned = false;
31558 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31559 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
31560 uintptr_t ret_ref = 0;
31561 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31562 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31564 ret_ref = (uintptr_t)ret_var.inner;
31565 if (ret_var.is_owned) {
31571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31572 LDKUpdateFailMalformedHTLC this_obj_conv;
31573 this_obj_conv.inner = (void*)(this_obj & (~1));
31574 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31576 UpdateFailMalformedHTLC_free(this_obj_conv);
31579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31580 LDKUpdateFailMalformedHTLC this_ptr_conv;
31581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31582 this_ptr_conv.is_owned = false;
31583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31584 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31585 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
31589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31590 LDKUpdateFailMalformedHTLC this_ptr_conv;
31591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31592 this_ptr_conv.is_owned = false;
31593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31594 LDKThirtyTwoBytes val_ref;
31595 CHECK((*env)->GetArrayLength(env, val) == 32);
31596 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31597 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
31600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31601 LDKUpdateFailMalformedHTLC this_ptr_conv;
31602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31603 this_ptr_conv.is_owned = false;
31604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31605 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
31609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31610 LDKUpdateFailMalformedHTLC this_ptr_conv;
31611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31612 this_ptr_conv.is_owned = false;
31613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31614 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
31617 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
31618 LDKUpdateFailMalformedHTLC this_ptr_conv;
31619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31620 this_ptr_conv.is_owned = false;
31621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31622 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
31626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31627 LDKUpdateFailMalformedHTLC this_ptr_conv;
31628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31629 this_ptr_conv.is_owned = false;
31630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31631 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
31634 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
31635 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
31636 uintptr_t ret_ref = 0;
31637 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31638 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31640 ret_ref = (uintptr_t)ret_var.inner;
31641 if (ret_var.is_owned) {
31646 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31647 LDKUpdateFailMalformedHTLC arg_conv;
31648 arg_conv.inner = (void*)(arg & (~1));
31649 arg_conv.is_owned = false;
31650 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31651 intptr_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
31655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31656 LDKUpdateFailMalformedHTLC orig_conv;
31657 orig_conv.inner = (void*)(orig & (~1));
31658 orig_conv.is_owned = false;
31659 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31660 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
31661 uintptr_t ret_ref = 0;
31662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31665 ret_ref = (uintptr_t)ret_var.inner;
31666 if (ret_var.is_owned) {
31672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31673 LDKCommitmentSigned this_obj_conv;
31674 this_obj_conv.inner = (void*)(this_obj & (~1));
31675 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31677 CommitmentSigned_free(this_obj_conv);
31680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31681 LDKCommitmentSigned this_ptr_conv;
31682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31683 this_ptr_conv.is_owned = false;
31684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31685 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31686 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
31690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31691 LDKCommitmentSigned this_ptr_conv;
31692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31693 this_ptr_conv.is_owned = false;
31694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31695 LDKThirtyTwoBytes val_ref;
31696 CHECK((*env)->GetArrayLength(env, val) == 32);
31697 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31698 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
31701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31702 LDKCommitmentSigned this_ptr_conv;
31703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31704 this_ptr_conv.is_owned = false;
31705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31706 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31707 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
31711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31712 LDKCommitmentSigned this_ptr_conv;
31713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31714 this_ptr_conv.is_owned = false;
31715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31716 LDKSignature val_ref;
31717 CHECK((*env)->GetArrayLength(env, val) == 64);
31718 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31719 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
31722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
31723 LDKCommitmentSigned this_ptr_conv;
31724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31725 this_ptr_conv.is_owned = false;
31726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31727 LDKCVec_SignatureZ val_constr;
31728 val_constr.datalen = (*env)->GetArrayLength(env, val);
31729 if (val_constr.datalen > 0)
31730 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
31732 val_constr.data = NULL;
31733 for (size_t i = 0; i < val_constr.datalen; i++) {
31734 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
31735 LDKSignature val_conv_8_ref;
31736 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
31737 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
31738 val_constr.data[i] = val_conv_8_ref;
31740 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
31743 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) {
31744 LDKThirtyTwoBytes channel_id_arg_ref;
31745 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31746 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31747 LDKSignature signature_arg_ref;
31748 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31749 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31750 LDKCVec_SignatureZ htlc_signatures_arg_constr;
31751 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
31752 if (htlc_signatures_arg_constr.datalen > 0)
31753 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
31755 htlc_signatures_arg_constr.data = NULL;
31756 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
31757 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
31758 LDKSignature htlc_signatures_arg_conv_8_ref;
31759 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
31760 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
31761 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
31763 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
31764 uintptr_t ret_ref = 0;
31765 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31766 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31768 ret_ref = (uintptr_t)ret_var.inner;
31769 if (ret_var.is_owned) {
31775 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
31776 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
31777 uintptr_t ret_ref = 0;
31778 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31779 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31781 ret_ref = (uintptr_t)ret_var.inner;
31782 if (ret_var.is_owned) {
31787 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31788 LDKCommitmentSigned arg_conv;
31789 arg_conv.inner = (void*)(arg & (~1));
31790 arg_conv.is_owned = false;
31791 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31792 intptr_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
31796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31797 LDKCommitmentSigned orig_conv;
31798 orig_conv.inner = (void*)(orig & (~1));
31799 orig_conv.is_owned = false;
31800 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31801 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
31802 uintptr_t ret_ref = 0;
31803 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31804 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31805 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31806 ret_ref = (uintptr_t)ret_var.inner;
31807 if (ret_var.is_owned) {
31813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31814 LDKRevokeAndACK this_obj_conv;
31815 this_obj_conv.inner = (void*)(this_obj & (~1));
31816 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31818 RevokeAndACK_free(this_obj_conv);
31821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31822 LDKRevokeAndACK this_ptr_conv;
31823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31824 this_ptr_conv.is_owned = false;
31825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31826 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31827 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
31831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31832 LDKRevokeAndACK this_ptr_conv;
31833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31834 this_ptr_conv.is_owned = false;
31835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31836 LDKThirtyTwoBytes val_ref;
31837 CHECK((*env)->GetArrayLength(env, val) == 32);
31838 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31839 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
31842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
31843 LDKRevokeAndACK this_ptr_conv;
31844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31845 this_ptr_conv.is_owned = false;
31846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31847 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31848 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
31852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31853 LDKRevokeAndACK this_ptr_conv;
31854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31855 this_ptr_conv.is_owned = false;
31856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31857 LDKThirtyTwoBytes val_ref;
31858 CHECK((*env)->GetArrayLength(env, val) == 32);
31859 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31860 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
31863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31864 LDKRevokeAndACK this_ptr_conv;
31865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31866 this_ptr_conv.is_owned = false;
31867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31868 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31869 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
31873 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) {
31874 LDKRevokeAndACK this_ptr_conv;
31875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31876 this_ptr_conv.is_owned = false;
31877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31878 LDKPublicKey val_ref;
31879 CHECK((*env)->GetArrayLength(env, val) == 33);
31880 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31881 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31884 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) {
31885 LDKThirtyTwoBytes channel_id_arg_ref;
31886 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31887 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31888 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
31889 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
31890 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
31891 LDKPublicKey next_per_commitment_point_arg_ref;
31892 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
31893 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
31894 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
31895 uintptr_t ret_ref = 0;
31896 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31897 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31899 ret_ref = (uintptr_t)ret_var.inner;
31900 if (ret_var.is_owned) {
31906 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
31907 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
31908 uintptr_t ret_ref = 0;
31909 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31910 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31911 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31912 ret_ref = (uintptr_t)ret_var.inner;
31913 if (ret_var.is_owned) {
31918 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31919 LDKRevokeAndACK arg_conv;
31920 arg_conv.inner = (void*)(arg & (~1));
31921 arg_conv.is_owned = false;
31922 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31923 intptr_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
31927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31928 LDKRevokeAndACK orig_conv;
31929 orig_conv.inner = (void*)(orig & (~1));
31930 orig_conv.is_owned = false;
31931 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31932 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
31933 uintptr_t ret_ref = 0;
31934 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31935 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31937 ret_ref = (uintptr_t)ret_var.inner;
31938 if (ret_var.is_owned) {
31944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31945 LDKUpdateFee this_obj_conv;
31946 this_obj_conv.inner = (void*)(this_obj & (~1));
31947 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31949 UpdateFee_free(this_obj_conv);
31952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31953 LDKUpdateFee this_ptr_conv;
31954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31955 this_ptr_conv.is_owned = false;
31956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31957 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31958 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
31962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31963 LDKUpdateFee this_ptr_conv;
31964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31965 this_ptr_conv.is_owned = false;
31966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31967 LDKThirtyTwoBytes val_ref;
31968 CHECK((*env)->GetArrayLength(env, val) == 32);
31969 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31970 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
31973 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
31974 LDKUpdateFee this_ptr_conv;
31975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31976 this_ptr_conv.is_owned = false;
31977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31978 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
31982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31983 LDKUpdateFee this_ptr_conv;
31984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31985 this_ptr_conv.is_owned = false;
31986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31987 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
31990 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) {
31991 LDKThirtyTwoBytes channel_id_arg_ref;
31992 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31993 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31994 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
31995 uintptr_t ret_ref = 0;
31996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31999 ret_ref = (uintptr_t)ret_var.inner;
32000 if (ret_var.is_owned) {
32006 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
32007 LDKUpdateFee ret_var = UpdateFee_clone(arg);
32008 uintptr_t ret_ref = 0;
32009 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32010 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32011 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32012 ret_ref = (uintptr_t)ret_var.inner;
32013 if (ret_var.is_owned) {
32018 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32019 LDKUpdateFee arg_conv;
32020 arg_conv.inner = (void*)(arg & (~1));
32021 arg_conv.is_owned = false;
32022 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32023 intptr_t ret_val = UpdateFee_clone_ptr(&arg_conv);
32027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32028 LDKUpdateFee orig_conv;
32029 orig_conv.inner = (void*)(orig & (~1));
32030 orig_conv.is_owned = false;
32031 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32032 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
32033 uintptr_t ret_ref = 0;
32034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32037 ret_ref = (uintptr_t)ret_var.inner;
32038 if (ret_var.is_owned) {
32044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32045 LDKDataLossProtect this_obj_conv;
32046 this_obj_conv.inner = (void*)(this_obj & (~1));
32047 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32049 DataLossProtect_free(this_obj_conv);
32052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
32053 LDKDataLossProtect this_ptr_conv;
32054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32055 this_ptr_conv.is_owned = false;
32056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32057 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32058 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
32062 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) {
32063 LDKDataLossProtect this_ptr_conv;
32064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32065 this_ptr_conv.is_owned = false;
32066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32067 LDKThirtyTwoBytes val_ref;
32068 CHECK((*env)->GetArrayLength(env, val) == 32);
32069 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32070 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
32073 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32074 LDKDataLossProtect this_ptr_conv;
32075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32076 this_ptr_conv.is_owned = false;
32077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32078 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32079 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
32083 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) {
32084 LDKDataLossProtect this_ptr_conv;
32085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32086 this_ptr_conv.is_owned = false;
32087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32088 LDKPublicKey val_ref;
32089 CHECK((*env)->GetArrayLength(env, val) == 33);
32090 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32091 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
32094 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) {
32095 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
32096 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
32097 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
32098 LDKPublicKey my_current_per_commitment_point_arg_ref;
32099 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
32100 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
32101 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
32102 uintptr_t ret_ref = 0;
32103 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32104 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32105 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32106 ret_ref = (uintptr_t)ret_var.inner;
32107 if (ret_var.is_owned) {
32113 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
32114 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
32115 uintptr_t ret_ref = 0;
32116 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32117 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32119 ret_ref = (uintptr_t)ret_var.inner;
32120 if (ret_var.is_owned) {
32125 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32126 LDKDataLossProtect arg_conv;
32127 arg_conv.inner = (void*)(arg & (~1));
32128 arg_conv.is_owned = false;
32129 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32130 intptr_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
32134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32135 LDKDataLossProtect orig_conv;
32136 orig_conv.inner = (void*)(orig & (~1));
32137 orig_conv.is_owned = false;
32138 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32139 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
32140 uintptr_t ret_ref = 0;
32141 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32142 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32144 ret_ref = (uintptr_t)ret_var.inner;
32145 if (ret_var.is_owned) {
32151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32152 LDKChannelReestablish this_obj_conv;
32153 this_obj_conv.inner = (void*)(this_obj & (~1));
32154 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32156 ChannelReestablish_free(this_obj_conv);
32159 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32160 LDKChannelReestablish this_ptr_conv;
32161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32162 this_ptr_conv.is_owned = false;
32163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32164 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32165 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
32169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32170 LDKChannelReestablish this_ptr_conv;
32171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32172 this_ptr_conv.is_owned = false;
32173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32174 LDKThirtyTwoBytes val_ref;
32175 CHECK((*env)->GetArrayLength(env, val) == 32);
32176 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32177 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
32180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
32181 LDKChannelReestablish this_ptr_conv;
32182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32183 this_ptr_conv.is_owned = false;
32184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32185 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
32189 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) {
32190 LDKChannelReestablish this_ptr_conv;
32191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32192 this_ptr_conv.is_owned = false;
32193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32194 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
32197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
32198 LDKChannelReestablish this_ptr_conv;
32199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32200 this_ptr_conv.is_owned = false;
32201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32202 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
32206 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) {
32207 LDKChannelReestablish this_ptr_conv;
32208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32209 this_ptr_conv.is_owned = false;
32210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32211 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
32214 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
32215 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
32216 uintptr_t ret_ref = 0;
32217 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32218 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32220 ret_ref = (uintptr_t)ret_var.inner;
32221 if (ret_var.is_owned) {
32226 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32227 LDKChannelReestablish arg_conv;
32228 arg_conv.inner = (void*)(arg & (~1));
32229 arg_conv.is_owned = false;
32230 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32231 intptr_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
32235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32236 LDKChannelReestablish orig_conv;
32237 orig_conv.inner = (void*)(orig & (~1));
32238 orig_conv.is_owned = false;
32239 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32240 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
32241 uintptr_t ret_ref = 0;
32242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32245 ret_ref = (uintptr_t)ret_var.inner;
32246 if (ret_var.is_owned) {
32252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32253 LDKAnnouncementSignatures this_obj_conv;
32254 this_obj_conv.inner = (void*)(this_obj & (~1));
32255 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32257 AnnouncementSignatures_free(this_obj_conv);
32260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32261 LDKAnnouncementSignatures this_ptr_conv;
32262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32263 this_ptr_conv.is_owned = false;
32264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32265 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32266 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
32270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32271 LDKAnnouncementSignatures this_ptr_conv;
32272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32273 this_ptr_conv.is_owned = false;
32274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32275 LDKThirtyTwoBytes val_ref;
32276 CHECK((*env)->GetArrayLength(env, val) == 32);
32277 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32278 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
32281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32282 LDKAnnouncementSignatures this_ptr_conv;
32283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32284 this_ptr_conv.is_owned = false;
32285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32286 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
32290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32291 LDKAnnouncementSignatures this_ptr_conv;
32292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32293 this_ptr_conv.is_owned = false;
32294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32295 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
32298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32299 LDKAnnouncementSignatures this_ptr_conv;
32300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32301 this_ptr_conv.is_owned = false;
32302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32303 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32304 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
32308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32309 LDKAnnouncementSignatures this_ptr_conv;
32310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32311 this_ptr_conv.is_owned = false;
32312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32313 LDKSignature val_ref;
32314 CHECK((*env)->GetArrayLength(env, val) == 64);
32315 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32316 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
32319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32320 LDKAnnouncementSignatures this_ptr_conv;
32321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32322 this_ptr_conv.is_owned = false;
32323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32324 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32325 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
32329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32330 LDKAnnouncementSignatures this_ptr_conv;
32331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32332 this_ptr_conv.is_owned = false;
32333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32334 LDKSignature val_ref;
32335 CHECK((*env)->GetArrayLength(env, val) == 64);
32336 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32337 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
32340 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) {
32341 LDKThirtyTwoBytes channel_id_arg_ref;
32342 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32343 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32344 LDKSignature node_signature_arg_ref;
32345 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
32346 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
32347 LDKSignature bitcoin_signature_arg_ref;
32348 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
32349 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
32350 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
32351 uintptr_t ret_ref = 0;
32352 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32353 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32355 ret_ref = (uintptr_t)ret_var.inner;
32356 if (ret_var.is_owned) {
32362 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
32363 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
32364 uintptr_t ret_ref = 0;
32365 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32366 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32368 ret_ref = (uintptr_t)ret_var.inner;
32369 if (ret_var.is_owned) {
32374 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32375 LDKAnnouncementSignatures arg_conv;
32376 arg_conv.inner = (void*)(arg & (~1));
32377 arg_conv.is_owned = false;
32378 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32379 intptr_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
32383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32384 LDKAnnouncementSignatures orig_conv;
32385 orig_conv.inner = (void*)(orig & (~1));
32386 orig_conv.is_owned = false;
32387 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32388 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
32389 uintptr_t ret_ref = 0;
32390 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32391 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32392 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32393 ret_ref = (uintptr_t)ret_var.inner;
32394 if (ret_var.is_owned) {
32400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32401 if ((this_ptr & 1) != 0) return;
32402 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32403 CHECK_ACCESS(this_ptr_ptr);
32404 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
32405 FREE((void*)this_ptr);
32406 NetAddress_free(this_ptr_conv);
32409 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
32410 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32411 *ret_copy = NetAddress_clone(arg);
32412 uintptr_t ret_ref = (uintptr_t)ret_copy;
32415 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32416 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
32417 intptr_t ret_val = NetAddress_clone_ptr(arg_conv);
32421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32422 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
32423 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32424 *ret_copy = NetAddress_clone(orig_conv);
32425 uintptr_t ret_ref = (uintptr_t)ret_copy;
32429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
32430 LDKFourBytes addr_ref;
32431 CHECK((*env)->GetArrayLength(env, addr) == 4);
32432 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
32433 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32434 *ret_copy = NetAddress_ipv4(addr_ref, port);
32435 uintptr_t ret_ref = (uintptr_t)ret_copy;
32439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
32440 LDKSixteenBytes addr_ref;
32441 CHECK((*env)->GetArrayLength(env, addr) == 16);
32442 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
32443 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32444 *ret_copy = NetAddress_ipv6(addr_ref, port);
32445 uintptr_t ret_ref = (uintptr_t)ret_copy;
32449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
32450 LDKTwelveBytes a_ref;
32451 CHECK((*env)->GetArrayLength(env, a) == 12);
32452 (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
32453 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32454 *ret_copy = NetAddress_onion_v2(a_ref);
32455 uintptr_t ret_ref = (uintptr_t)ret_copy;
32459 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) {
32460 LDKThirtyTwoBytes ed25519_pubkey_ref;
32461 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
32462 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
32463 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32464 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
32465 uintptr_t ret_ref = (uintptr_t)ret_copy;
32469 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
32470 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
32471 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
32472 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32473 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32474 CVec_u8Z_free(ret_var);
32478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32479 LDKu8slice ser_ref;
32480 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32481 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32482 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
32483 *ret_conv = NetAddress_read(ser_ref);
32484 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32485 return (uintptr_t)ret_conv;
32488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32489 LDKUnsignedNodeAnnouncement this_obj_conv;
32490 this_obj_conv.inner = (void*)(this_obj & (~1));
32491 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32493 UnsignedNodeAnnouncement_free(this_obj_conv);
32496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
32497 LDKUnsignedNodeAnnouncement this_ptr_conv;
32498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32499 this_ptr_conv.is_owned = false;
32500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32501 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
32502 uintptr_t ret_ref = 0;
32503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32506 ret_ref = (uintptr_t)ret_var.inner;
32507 if (ret_var.is_owned) {
32513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32514 LDKUnsignedNodeAnnouncement this_ptr_conv;
32515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32516 this_ptr_conv.is_owned = false;
32517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32518 LDKNodeFeatures val_conv;
32519 val_conv.inner = (void*)(val & (~1));
32520 val_conv.is_owned = (val & 1) || (val == 0);
32521 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32522 val_conv = NodeFeatures_clone(&val_conv);
32523 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
32526 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
32527 LDKUnsignedNodeAnnouncement this_ptr_conv;
32528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32529 this_ptr_conv.is_owned = false;
32530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32531 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
32535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32536 LDKUnsignedNodeAnnouncement this_ptr_conv;
32537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32538 this_ptr_conv.is_owned = false;
32539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32540 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
32543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32544 LDKUnsignedNodeAnnouncement this_ptr_conv;
32545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32546 this_ptr_conv.is_owned = false;
32547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32548 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32549 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
32553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32554 LDKUnsignedNodeAnnouncement 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 LDKPublicKey val_ref;
32559 CHECK((*env)->GetArrayLength(env, val) == 33);
32560 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32561 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
32564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
32565 LDKUnsignedNodeAnnouncement this_ptr_conv;
32566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32567 this_ptr_conv.is_owned = false;
32568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32569 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
32570 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
32574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32575 LDKUnsignedNodeAnnouncement this_ptr_conv;
32576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32577 this_ptr_conv.is_owned = false;
32578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32579 LDKThreeBytes val_ref;
32580 CHECK((*env)->GetArrayLength(env, val) == 3);
32581 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
32582 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
32585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
32586 LDKUnsignedNodeAnnouncement this_ptr_conv;
32587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32588 this_ptr_conv.is_owned = false;
32589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32590 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32591 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
32595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32596 LDKUnsignedNodeAnnouncement this_ptr_conv;
32597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32598 this_ptr_conv.is_owned = false;
32599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32600 LDKThirtyTwoBytes val_ref;
32601 CHECK((*env)->GetArrayLength(env, val) == 32);
32602 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32603 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
32606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
32607 LDKUnsignedNodeAnnouncement this_ptr_conv;
32608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32609 this_ptr_conv.is_owned = false;
32610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32611 LDKCVec_NetAddressZ val_constr;
32612 val_constr.datalen = (*env)->GetArrayLength(env, val);
32613 if (val_constr.datalen > 0)
32614 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32616 val_constr.data = NULL;
32617 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
32618 for (size_t m = 0; m < val_constr.datalen; m++) {
32619 int64_t val_conv_12 = val_vals[m];
32620 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
32621 CHECK_ACCESS(val_conv_12_ptr);
32622 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32623 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
32624 val_constr.data[m] = val_conv_12_conv;
32626 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
32627 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
32630 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
32631 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
32632 uintptr_t ret_ref = 0;
32633 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32634 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32636 ret_ref = (uintptr_t)ret_var.inner;
32637 if (ret_var.is_owned) {
32642 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32643 LDKUnsignedNodeAnnouncement arg_conv;
32644 arg_conv.inner = (void*)(arg & (~1));
32645 arg_conv.is_owned = false;
32646 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32647 intptr_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
32651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32652 LDKUnsignedNodeAnnouncement orig_conv;
32653 orig_conv.inner = (void*)(orig & (~1));
32654 orig_conv.is_owned = false;
32655 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32656 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
32657 uintptr_t ret_ref = 0;
32658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32661 ret_ref = (uintptr_t)ret_var.inner;
32662 if (ret_var.is_owned) {
32668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32669 LDKNodeAnnouncement this_obj_conv;
32670 this_obj_conv.inner = (void*)(this_obj & (~1));
32671 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32673 NodeAnnouncement_free(this_obj_conv);
32676 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32677 LDKNodeAnnouncement this_ptr_conv;
32678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32679 this_ptr_conv.is_owned = false;
32680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32681 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32682 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
32686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32687 LDKNodeAnnouncement this_ptr_conv;
32688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32689 this_ptr_conv.is_owned = false;
32690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32691 LDKSignature val_ref;
32692 CHECK((*env)->GetArrayLength(env, val) == 64);
32693 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32694 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
32697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
32698 LDKNodeAnnouncement this_ptr_conv;
32699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32700 this_ptr_conv.is_owned = false;
32701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32702 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
32703 uintptr_t ret_ref = 0;
32704 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32705 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32707 ret_ref = (uintptr_t)ret_var.inner;
32708 if (ret_var.is_owned) {
32714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32715 LDKNodeAnnouncement this_ptr_conv;
32716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32717 this_ptr_conv.is_owned = false;
32718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32719 LDKUnsignedNodeAnnouncement val_conv;
32720 val_conv.inner = (void*)(val & (~1));
32721 val_conv.is_owned = (val & 1) || (val == 0);
32722 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32723 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
32724 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
32727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
32728 LDKSignature signature_arg_ref;
32729 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32730 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32731 LDKUnsignedNodeAnnouncement contents_arg_conv;
32732 contents_arg_conv.inner = (void*)(contents_arg & (~1));
32733 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
32734 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32735 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
32736 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
32737 uintptr_t ret_ref = 0;
32738 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32739 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32740 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32741 ret_ref = (uintptr_t)ret_var.inner;
32742 if (ret_var.is_owned) {
32748 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
32749 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
32750 uintptr_t ret_ref = 0;
32751 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32752 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32754 ret_ref = (uintptr_t)ret_var.inner;
32755 if (ret_var.is_owned) {
32760 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32761 LDKNodeAnnouncement arg_conv;
32762 arg_conv.inner = (void*)(arg & (~1));
32763 arg_conv.is_owned = false;
32764 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32765 intptr_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
32769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32770 LDKNodeAnnouncement orig_conv;
32771 orig_conv.inner = (void*)(orig & (~1));
32772 orig_conv.is_owned = false;
32773 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32774 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
32775 uintptr_t ret_ref = 0;
32776 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32777 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32779 ret_ref = (uintptr_t)ret_var.inner;
32780 if (ret_var.is_owned) {
32786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32787 LDKUnsignedChannelAnnouncement this_obj_conv;
32788 this_obj_conv.inner = (void*)(this_obj & (~1));
32789 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32791 UnsignedChannelAnnouncement_free(this_obj_conv);
32794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
32795 LDKUnsignedChannelAnnouncement this_ptr_conv;
32796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32797 this_ptr_conv.is_owned = false;
32798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32799 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
32800 uintptr_t ret_ref = 0;
32801 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32802 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32803 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32804 ret_ref = (uintptr_t)ret_var.inner;
32805 if (ret_var.is_owned) {
32811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32812 LDKUnsignedChannelAnnouncement this_ptr_conv;
32813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32814 this_ptr_conv.is_owned = false;
32815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32816 LDKChannelFeatures val_conv;
32817 val_conv.inner = (void*)(val & (~1));
32818 val_conv.is_owned = (val & 1) || (val == 0);
32819 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32820 val_conv = ChannelFeatures_clone(&val_conv);
32821 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
32824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32825 LDKUnsignedChannelAnnouncement this_ptr_conv;
32826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32827 this_ptr_conv.is_owned = false;
32828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32829 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32830 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
32834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32835 LDKUnsignedChannelAnnouncement this_ptr_conv;
32836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32837 this_ptr_conv.is_owned = false;
32838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32839 LDKThirtyTwoBytes val_ref;
32840 CHECK((*env)->GetArrayLength(env, val) == 32);
32841 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32842 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
32845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32846 LDKUnsignedChannelAnnouncement this_ptr_conv;
32847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32848 this_ptr_conv.is_owned = false;
32849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32850 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
32854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32855 LDKUnsignedChannelAnnouncement this_ptr_conv;
32856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32857 this_ptr_conv.is_owned = false;
32858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32859 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
32862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
32863 LDKUnsignedChannelAnnouncement this_ptr_conv;
32864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32865 this_ptr_conv.is_owned = false;
32866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32867 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32868 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
32872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32873 LDKUnsignedChannelAnnouncement this_ptr_conv;
32874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32875 this_ptr_conv.is_owned = false;
32876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32877 LDKPublicKey val_ref;
32878 CHECK((*env)->GetArrayLength(env, val) == 33);
32879 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32880 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
32883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
32884 LDKUnsignedChannelAnnouncement this_ptr_conv;
32885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32886 this_ptr_conv.is_owned = false;
32887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32888 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32889 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
32893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32894 LDKUnsignedChannelAnnouncement this_ptr_conv;
32895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32896 this_ptr_conv.is_owned = false;
32897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32898 LDKPublicKey val_ref;
32899 CHECK((*env)->GetArrayLength(env, val) == 33);
32900 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32901 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
32904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
32905 LDKUnsignedChannelAnnouncement this_ptr_conv;
32906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32907 this_ptr_conv.is_owned = false;
32908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32909 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32910 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
32914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32915 LDKUnsignedChannelAnnouncement this_ptr_conv;
32916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32917 this_ptr_conv.is_owned = false;
32918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32919 LDKPublicKey val_ref;
32920 CHECK((*env)->GetArrayLength(env, val) == 33);
32921 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32922 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
32925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
32926 LDKUnsignedChannelAnnouncement this_ptr_conv;
32927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32928 this_ptr_conv.is_owned = false;
32929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32930 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32931 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
32935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32936 LDKUnsignedChannelAnnouncement this_ptr_conv;
32937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32938 this_ptr_conv.is_owned = false;
32939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32940 LDKPublicKey val_ref;
32941 CHECK((*env)->GetArrayLength(env, val) == 33);
32942 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32943 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
32946 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
32947 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
32948 uintptr_t ret_ref = 0;
32949 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32950 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32952 ret_ref = (uintptr_t)ret_var.inner;
32953 if (ret_var.is_owned) {
32958 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32959 LDKUnsignedChannelAnnouncement arg_conv;
32960 arg_conv.inner = (void*)(arg & (~1));
32961 arg_conv.is_owned = false;
32962 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32963 intptr_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
32967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32968 LDKUnsignedChannelAnnouncement orig_conv;
32969 orig_conv.inner = (void*)(orig & (~1));
32970 orig_conv.is_owned = false;
32971 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32972 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
32973 uintptr_t ret_ref = 0;
32974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32975 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32977 ret_ref = (uintptr_t)ret_var.inner;
32978 if (ret_var.is_owned) {
32984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32985 LDKChannelAnnouncement this_obj_conv;
32986 this_obj_conv.inner = (void*)(this_obj & (~1));
32987 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32989 ChannelAnnouncement_free(this_obj_conv);
32992 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
32993 LDKChannelAnnouncement this_ptr_conv;
32994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32995 this_ptr_conv.is_owned = false;
32996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32997 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32998 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
33002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33003 LDKChannelAnnouncement this_ptr_conv;
33004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33005 this_ptr_conv.is_owned = false;
33006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33007 LDKSignature val_ref;
33008 CHECK((*env)->GetArrayLength(env, val) == 64);
33009 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33010 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
33013 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33014 LDKChannelAnnouncement this_ptr_conv;
33015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33016 this_ptr_conv.is_owned = false;
33017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33018 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33019 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
33023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33024 LDKChannelAnnouncement this_ptr_conv;
33025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33026 this_ptr_conv.is_owned = false;
33027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33028 LDKSignature val_ref;
33029 CHECK((*env)->GetArrayLength(env, val) == 64);
33030 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33031 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
33034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33035 LDKChannelAnnouncement this_ptr_conv;
33036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33037 this_ptr_conv.is_owned = false;
33038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33039 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33040 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
33044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33045 LDKChannelAnnouncement this_ptr_conv;
33046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33047 this_ptr_conv.is_owned = false;
33048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33049 LDKSignature val_ref;
33050 CHECK((*env)->GetArrayLength(env, val) == 64);
33051 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33052 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
33055 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33056 LDKChannelAnnouncement this_ptr_conv;
33057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33058 this_ptr_conv.is_owned = false;
33059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33060 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33061 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
33065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33066 LDKChannelAnnouncement this_ptr_conv;
33067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33068 this_ptr_conv.is_owned = false;
33069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33070 LDKSignature val_ref;
33071 CHECK((*env)->GetArrayLength(env, val) == 64);
33072 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33073 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
33076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
33077 LDKChannelAnnouncement this_ptr_conv;
33078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33079 this_ptr_conv.is_owned = false;
33080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33081 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
33082 uintptr_t ret_ref = 0;
33083 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33084 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33085 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33086 ret_ref = (uintptr_t)ret_var.inner;
33087 if (ret_var.is_owned) {
33093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33094 LDKChannelAnnouncement this_ptr_conv;
33095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33096 this_ptr_conv.is_owned = false;
33097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33098 LDKUnsignedChannelAnnouncement val_conv;
33099 val_conv.inner = (void*)(val & (~1));
33100 val_conv.is_owned = (val & 1) || (val == 0);
33101 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33102 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
33103 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
33106 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) {
33107 LDKSignature node_signature_1_arg_ref;
33108 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
33109 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
33110 LDKSignature node_signature_2_arg_ref;
33111 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
33112 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
33113 LDKSignature bitcoin_signature_1_arg_ref;
33114 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
33115 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
33116 LDKSignature bitcoin_signature_2_arg_ref;
33117 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
33118 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
33119 LDKUnsignedChannelAnnouncement contents_arg_conv;
33120 contents_arg_conv.inner = (void*)(contents_arg & (~1));
33121 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
33122 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33123 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
33124 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);
33125 uintptr_t ret_ref = 0;
33126 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33127 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33129 ret_ref = (uintptr_t)ret_var.inner;
33130 if (ret_var.is_owned) {
33136 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
33137 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
33138 uintptr_t ret_ref = 0;
33139 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33140 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33141 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33142 ret_ref = (uintptr_t)ret_var.inner;
33143 if (ret_var.is_owned) {
33148 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33149 LDKChannelAnnouncement arg_conv;
33150 arg_conv.inner = (void*)(arg & (~1));
33151 arg_conv.is_owned = false;
33152 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33153 intptr_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
33157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33158 LDKChannelAnnouncement orig_conv;
33159 orig_conv.inner = (void*)(orig & (~1));
33160 orig_conv.is_owned = false;
33161 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33162 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
33163 uintptr_t ret_ref = 0;
33164 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33165 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33167 ret_ref = (uintptr_t)ret_var.inner;
33168 if (ret_var.is_owned) {
33174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33175 LDKUnsignedChannelUpdate this_obj_conv;
33176 this_obj_conv.inner = (void*)(this_obj & (~1));
33177 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33179 UnsignedChannelUpdate_free(this_obj_conv);
33182 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33183 LDKUnsignedChannelUpdate this_ptr_conv;
33184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33185 this_ptr_conv.is_owned = false;
33186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33187 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33188 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
33192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33193 LDKUnsignedChannelUpdate this_ptr_conv;
33194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33195 this_ptr_conv.is_owned = false;
33196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33197 LDKThirtyTwoBytes val_ref;
33198 CHECK((*env)->GetArrayLength(env, val) == 32);
33199 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33200 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
33203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33204 LDKUnsignedChannelUpdate this_ptr_conv;
33205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33206 this_ptr_conv.is_owned = false;
33207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33208 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
33212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33213 LDKUnsignedChannelUpdate this_ptr_conv;
33214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33215 this_ptr_conv.is_owned = false;
33216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33217 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
33220 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
33221 LDKUnsignedChannelUpdate this_ptr_conv;
33222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33223 this_ptr_conv.is_owned = false;
33224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33225 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
33229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33230 LDKUnsignedChannelUpdate this_ptr_conv;
33231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33232 this_ptr_conv.is_owned = false;
33233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33234 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
33237 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
33238 LDKUnsignedChannelUpdate this_ptr_conv;
33239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33240 this_ptr_conv.is_owned = false;
33241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33242 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
33246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
33247 LDKUnsignedChannelUpdate this_ptr_conv;
33248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33249 this_ptr_conv.is_owned = false;
33250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33251 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
33254 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
33255 LDKUnsignedChannelUpdate this_ptr_conv;
33256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33257 this_ptr_conv.is_owned = false;
33258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33259 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
33263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33264 LDKUnsignedChannelUpdate this_ptr_conv;
33265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33266 this_ptr_conv.is_owned = false;
33267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33268 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
33271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33272 LDKUnsignedChannelUpdate this_ptr_conv;
33273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33274 this_ptr_conv.is_owned = false;
33275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33276 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
33280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33281 LDKUnsignedChannelUpdate this_ptr_conv;
33282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33283 this_ptr_conv.is_owned = false;
33284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33285 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
33288 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33289 LDKUnsignedChannelUpdate this_ptr_conv;
33290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33291 this_ptr_conv.is_owned = false;
33292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33293 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
33297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33298 LDKUnsignedChannelUpdate this_ptr_conv;
33299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33300 this_ptr_conv.is_owned = false;
33301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33302 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
33305 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
33306 LDKUnsignedChannelUpdate this_ptr_conv;
33307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33308 this_ptr_conv.is_owned = false;
33309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33310 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
33314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33315 LDKUnsignedChannelUpdate this_ptr_conv;
33316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33317 this_ptr_conv.is_owned = false;
33318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33319 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
33322 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
33323 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
33324 uintptr_t ret_ref = 0;
33325 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33326 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33327 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33328 ret_ref = (uintptr_t)ret_var.inner;
33329 if (ret_var.is_owned) {
33334 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33335 LDKUnsignedChannelUpdate arg_conv;
33336 arg_conv.inner = (void*)(arg & (~1));
33337 arg_conv.is_owned = false;
33338 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33339 intptr_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
33343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33344 LDKUnsignedChannelUpdate orig_conv;
33345 orig_conv.inner = (void*)(orig & (~1));
33346 orig_conv.is_owned = false;
33347 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33348 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
33349 uintptr_t ret_ref = 0;
33350 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33351 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33353 ret_ref = (uintptr_t)ret_var.inner;
33354 if (ret_var.is_owned) {
33360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33361 LDKChannelUpdate this_obj_conv;
33362 this_obj_conv.inner = (void*)(this_obj & (~1));
33363 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33365 ChannelUpdate_free(this_obj_conv);
33368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33369 LDKChannelUpdate this_ptr_conv;
33370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33371 this_ptr_conv.is_owned = false;
33372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33373 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33374 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
33378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33379 LDKChannelUpdate this_ptr_conv;
33380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33381 this_ptr_conv.is_owned = false;
33382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33383 LDKSignature val_ref;
33384 CHECK((*env)->GetArrayLength(env, val) == 64);
33385 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33386 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
33389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
33390 LDKChannelUpdate this_ptr_conv;
33391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33392 this_ptr_conv.is_owned = false;
33393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33394 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
33395 uintptr_t ret_ref = 0;
33396 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33397 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33399 ret_ref = (uintptr_t)ret_var.inner;
33400 if (ret_var.is_owned) {
33406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33407 LDKChannelUpdate this_ptr_conv;
33408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33409 this_ptr_conv.is_owned = false;
33410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33411 LDKUnsignedChannelUpdate val_conv;
33412 val_conv.inner = (void*)(val & (~1));
33413 val_conv.is_owned = (val & 1) || (val == 0);
33414 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33415 val_conv = UnsignedChannelUpdate_clone(&val_conv);
33416 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
33419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
33420 LDKSignature signature_arg_ref;
33421 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33422 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33423 LDKUnsignedChannelUpdate contents_arg_conv;
33424 contents_arg_conv.inner = (void*)(contents_arg & (~1));
33425 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
33426 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33427 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
33428 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
33429 uintptr_t ret_ref = 0;
33430 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33431 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33432 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33433 ret_ref = (uintptr_t)ret_var.inner;
33434 if (ret_var.is_owned) {
33440 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
33441 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
33442 uintptr_t ret_ref = 0;
33443 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33444 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33446 ret_ref = (uintptr_t)ret_var.inner;
33447 if (ret_var.is_owned) {
33452 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33453 LDKChannelUpdate arg_conv;
33454 arg_conv.inner = (void*)(arg & (~1));
33455 arg_conv.is_owned = false;
33456 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33457 intptr_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
33461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33462 LDKChannelUpdate orig_conv;
33463 orig_conv.inner = (void*)(orig & (~1));
33464 orig_conv.is_owned = false;
33465 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33466 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
33467 uintptr_t ret_ref = 0;
33468 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33469 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33471 ret_ref = (uintptr_t)ret_var.inner;
33472 if (ret_var.is_owned) {
33478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33479 LDKQueryChannelRange this_obj_conv;
33480 this_obj_conv.inner = (void*)(this_obj & (~1));
33481 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33483 QueryChannelRange_free(this_obj_conv);
33486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33487 LDKQueryChannelRange this_ptr_conv;
33488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33489 this_ptr_conv.is_owned = false;
33490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33491 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33492 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
33496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33497 LDKQueryChannelRange this_ptr_conv;
33498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33499 this_ptr_conv.is_owned = false;
33500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33501 LDKThirtyTwoBytes val_ref;
33502 CHECK((*env)->GetArrayLength(env, val) == 32);
33503 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33504 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
33507 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
33508 LDKQueryChannelRange this_ptr_conv;
33509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33510 this_ptr_conv.is_owned = false;
33511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33512 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
33516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33517 LDKQueryChannelRange this_ptr_conv;
33518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33519 this_ptr_conv.is_owned = false;
33520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33521 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
33524 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
33525 LDKQueryChannelRange this_ptr_conv;
33526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33527 this_ptr_conv.is_owned = false;
33528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33529 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
33533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33534 LDKQueryChannelRange this_ptr_conv;
33535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33536 this_ptr_conv.is_owned = false;
33537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33538 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
33541 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) {
33542 LDKThirtyTwoBytes chain_hash_arg_ref;
33543 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
33544 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
33545 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
33546 uintptr_t ret_ref = 0;
33547 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33548 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33550 ret_ref = (uintptr_t)ret_var.inner;
33551 if (ret_var.is_owned) {
33557 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
33558 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
33559 uintptr_t ret_ref = 0;
33560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33563 ret_ref = (uintptr_t)ret_var.inner;
33564 if (ret_var.is_owned) {
33569 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33570 LDKQueryChannelRange arg_conv;
33571 arg_conv.inner = (void*)(arg & (~1));
33572 arg_conv.is_owned = false;
33573 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33574 intptr_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
33578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33579 LDKQueryChannelRange orig_conv;
33580 orig_conv.inner = (void*)(orig & (~1));
33581 orig_conv.is_owned = false;
33582 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33583 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
33584 uintptr_t ret_ref = 0;
33585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33588 ret_ref = (uintptr_t)ret_var.inner;
33589 if (ret_var.is_owned) {
33595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33596 LDKReplyChannelRange this_obj_conv;
33597 this_obj_conv.inner = (void*)(this_obj & (~1));
33598 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33600 ReplyChannelRange_free(this_obj_conv);
33603 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33604 LDKReplyChannelRange this_ptr_conv;
33605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33606 this_ptr_conv.is_owned = false;
33607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33608 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33609 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
33613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33614 LDKReplyChannelRange this_ptr_conv;
33615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33616 this_ptr_conv.is_owned = false;
33617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33618 LDKThirtyTwoBytes val_ref;
33619 CHECK((*env)->GetArrayLength(env, val) == 32);
33620 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33621 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
33624 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
33625 LDKReplyChannelRange this_ptr_conv;
33626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33627 this_ptr_conv.is_owned = false;
33628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33629 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
33633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33634 LDKReplyChannelRange this_ptr_conv;
33635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33636 this_ptr_conv.is_owned = false;
33637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33638 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
33641 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
33642 LDKReplyChannelRange this_ptr_conv;
33643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33644 this_ptr_conv.is_owned = false;
33645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33646 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
33650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33651 LDKReplyChannelRange this_ptr_conv;
33652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33653 this_ptr_conv.is_owned = false;
33654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33655 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
33658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
33659 LDKReplyChannelRange this_ptr_conv;
33660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33661 this_ptr_conv.is_owned = false;
33662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33663 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
33667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33668 LDKReplyChannelRange this_ptr_conv;
33669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33670 this_ptr_conv.is_owned = false;
33671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33672 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
33675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
33676 LDKReplyChannelRange this_ptr_conv;
33677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33678 this_ptr_conv.is_owned = false;
33679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33680 LDKCVec_u64Z val_constr;
33681 val_constr.datalen = (*env)->GetArrayLength(env, val);
33682 if (val_constr.datalen > 0)
33683 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33685 val_constr.data = NULL;
33686 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
33687 for (size_t g = 0; g < val_constr.datalen; g++) {
33688 int64_t val_conv_6 = val_vals[g];
33689 val_constr.data[g] = val_conv_6;
33691 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
33692 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
33695 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) {
33696 LDKThirtyTwoBytes chain_hash_arg_ref;
33697 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
33698 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
33699 LDKCVec_u64Z short_channel_ids_arg_constr;
33700 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
33701 if (short_channel_ids_arg_constr.datalen > 0)
33702 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33704 short_channel_ids_arg_constr.data = NULL;
33705 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
33706 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
33707 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
33708 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
33710 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
33711 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
33712 uintptr_t ret_ref = 0;
33713 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33714 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33715 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33716 ret_ref = (uintptr_t)ret_var.inner;
33717 if (ret_var.is_owned) {
33723 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
33724 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
33725 uintptr_t ret_ref = 0;
33726 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33727 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33729 ret_ref = (uintptr_t)ret_var.inner;
33730 if (ret_var.is_owned) {
33735 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33736 LDKReplyChannelRange arg_conv;
33737 arg_conv.inner = (void*)(arg & (~1));
33738 arg_conv.is_owned = false;
33739 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33740 intptr_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
33744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33745 LDKReplyChannelRange orig_conv;
33746 orig_conv.inner = (void*)(orig & (~1));
33747 orig_conv.is_owned = false;
33748 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33749 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
33750 uintptr_t ret_ref = 0;
33751 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33752 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33754 ret_ref = (uintptr_t)ret_var.inner;
33755 if (ret_var.is_owned) {
33761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33762 LDKQueryShortChannelIds this_obj_conv;
33763 this_obj_conv.inner = (void*)(this_obj & (~1));
33764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33766 QueryShortChannelIds_free(this_obj_conv);
33769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33770 LDKQueryShortChannelIds this_ptr_conv;
33771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33772 this_ptr_conv.is_owned = false;
33773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33774 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33775 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
33779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33780 LDKQueryShortChannelIds this_ptr_conv;
33781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33782 this_ptr_conv.is_owned = false;
33783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33784 LDKThirtyTwoBytes val_ref;
33785 CHECK((*env)->GetArrayLength(env, val) == 32);
33786 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33787 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
33790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
33791 LDKQueryShortChannelIds this_ptr_conv;
33792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33793 this_ptr_conv.is_owned = false;
33794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33795 LDKCVec_u64Z val_constr;
33796 val_constr.datalen = (*env)->GetArrayLength(env, val);
33797 if (val_constr.datalen > 0)
33798 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33800 val_constr.data = NULL;
33801 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
33802 for (size_t g = 0; g < val_constr.datalen; g++) {
33803 int64_t val_conv_6 = val_vals[g];
33804 val_constr.data[g] = val_conv_6;
33806 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
33807 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
33810 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) {
33811 LDKThirtyTwoBytes chain_hash_arg_ref;
33812 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
33813 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
33814 LDKCVec_u64Z short_channel_ids_arg_constr;
33815 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
33816 if (short_channel_ids_arg_constr.datalen > 0)
33817 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33819 short_channel_ids_arg_constr.data = NULL;
33820 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
33821 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
33822 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
33823 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
33825 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
33826 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
33827 uintptr_t ret_ref = 0;
33828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33831 ret_ref = (uintptr_t)ret_var.inner;
33832 if (ret_var.is_owned) {
33838 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
33839 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
33840 uintptr_t ret_ref = 0;
33841 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33842 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33844 ret_ref = (uintptr_t)ret_var.inner;
33845 if (ret_var.is_owned) {
33850 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33851 LDKQueryShortChannelIds arg_conv;
33852 arg_conv.inner = (void*)(arg & (~1));
33853 arg_conv.is_owned = false;
33854 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33855 intptr_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
33859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33860 LDKQueryShortChannelIds orig_conv;
33861 orig_conv.inner = (void*)(orig & (~1));
33862 orig_conv.is_owned = false;
33863 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33864 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
33865 uintptr_t ret_ref = 0;
33866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33869 ret_ref = (uintptr_t)ret_var.inner;
33870 if (ret_var.is_owned) {
33876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33877 LDKReplyShortChannelIdsEnd this_obj_conv;
33878 this_obj_conv.inner = (void*)(this_obj & (~1));
33879 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33881 ReplyShortChannelIdsEnd_free(this_obj_conv);
33884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33885 LDKReplyShortChannelIdsEnd this_ptr_conv;
33886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33887 this_ptr_conv.is_owned = false;
33888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33889 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33890 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
33894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33895 LDKReplyShortChannelIdsEnd this_ptr_conv;
33896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33897 this_ptr_conv.is_owned = false;
33898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33899 LDKThirtyTwoBytes val_ref;
33900 CHECK((*env)->GetArrayLength(env, val) == 32);
33901 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33902 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
33905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
33906 LDKReplyShortChannelIdsEnd this_ptr_conv;
33907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33908 this_ptr_conv.is_owned = false;
33909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33910 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
33914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33915 LDKReplyShortChannelIdsEnd this_ptr_conv;
33916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33917 this_ptr_conv.is_owned = false;
33918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33919 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
33922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
33923 LDKThirtyTwoBytes chain_hash_arg_ref;
33924 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
33925 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
33926 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
33927 uintptr_t ret_ref = 0;
33928 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33929 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33930 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33931 ret_ref = (uintptr_t)ret_var.inner;
33932 if (ret_var.is_owned) {
33938 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
33939 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
33940 uintptr_t ret_ref = 0;
33941 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33942 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33943 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33944 ret_ref = (uintptr_t)ret_var.inner;
33945 if (ret_var.is_owned) {
33950 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33951 LDKReplyShortChannelIdsEnd arg_conv;
33952 arg_conv.inner = (void*)(arg & (~1));
33953 arg_conv.is_owned = false;
33954 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33955 intptr_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
33959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33960 LDKReplyShortChannelIdsEnd orig_conv;
33961 orig_conv.inner = (void*)(orig & (~1));
33962 orig_conv.is_owned = false;
33963 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33964 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
33965 uintptr_t ret_ref = 0;
33966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33969 ret_ref = (uintptr_t)ret_var.inner;
33970 if (ret_var.is_owned) {
33976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33977 LDKGossipTimestampFilter this_obj_conv;
33978 this_obj_conv.inner = (void*)(this_obj & (~1));
33979 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33981 GossipTimestampFilter_free(this_obj_conv);
33984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33985 LDKGossipTimestampFilter this_ptr_conv;
33986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33987 this_ptr_conv.is_owned = false;
33988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33989 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33990 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
33994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33995 LDKGossipTimestampFilter this_ptr_conv;
33996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33997 this_ptr_conv.is_owned = false;
33998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33999 LDKThirtyTwoBytes val_ref;
34000 CHECK((*env)->GetArrayLength(env, val) == 32);
34001 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34002 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
34005 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
34006 LDKGossipTimestampFilter this_ptr_conv;
34007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34008 this_ptr_conv.is_owned = false;
34009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34010 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
34014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34015 LDKGossipTimestampFilter this_ptr_conv;
34016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34017 this_ptr_conv.is_owned = false;
34018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34019 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
34022 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
34023 LDKGossipTimestampFilter this_ptr_conv;
34024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34025 this_ptr_conv.is_owned = false;
34026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34027 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
34031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34032 LDKGossipTimestampFilter this_ptr_conv;
34033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34034 this_ptr_conv.is_owned = false;
34035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34036 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
34039 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) {
34040 LDKThirtyTwoBytes chain_hash_arg_ref;
34041 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34042 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34043 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
34044 uintptr_t ret_ref = 0;
34045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34048 ret_ref = (uintptr_t)ret_var.inner;
34049 if (ret_var.is_owned) {
34055 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
34056 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
34057 uintptr_t ret_ref = 0;
34058 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34059 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34061 ret_ref = (uintptr_t)ret_var.inner;
34062 if (ret_var.is_owned) {
34067 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34068 LDKGossipTimestampFilter arg_conv;
34069 arg_conv.inner = (void*)(arg & (~1));
34070 arg_conv.is_owned = false;
34071 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34072 intptr_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
34076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34077 LDKGossipTimestampFilter orig_conv;
34078 orig_conv.inner = (void*)(orig & (~1));
34079 orig_conv.is_owned = false;
34080 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34081 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
34082 uintptr_t ret_ref = 0;
34083 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34084 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34085 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34086 ret_ref = (uintptr_t)ret_var.inner;
34087 if (ret_var.is_owned) {
34093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34094 if ((this_ptr & 1) != 0) return;
34095 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34096 CHECK_ACCESS(this_ptr_ptr);
34097 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
34098 FREE((void*)this_ptr);
34099 ErrorAction_free(this_ptr_conv);
34102 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
34103 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34104 *ret_copy = ErrorAction_clone(arg);
34105 uintptr_t ret_ref = (uintptr_t)ret_copy;
34108 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34109 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
34110 intptr_t ret_val = ErrorAction_clone_ptr(arg_conv);
34114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34115 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
34116 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34117 *ret_copy = ErrorAction_clone(orig_conv);
34118 uintptr_t ret_ref = (uintptr_t)ret_copy;
34122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
34123 LDKErrorMessage msg_conv;
34124 msg_conv.inner = (void*)(msg & (~1));
34125 msg_conv.is_owned = (msg & 1) || (msg == 0);
34126 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34127 msg_conv = ErrorMessage_clone(&msg_conv);
34128 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34129 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
34130 uintptr_t ret_ref = (uintptr_t)ret_copy;
34134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
34135 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34136 *ret_copy = ErrorAction_ignore_error();
34137 uintptr_t ret_ref = (uintptr_t)ret_copy;
34141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
34142 LDKLevel a_conv = LDKLevel_from_java(env, a);
34143 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34144 *ret_copy = ErrorAction_ignore_and_log(a_conv);
34145 uintptr_t ret_ref = (uintptr_t)ret_copy;
34149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
34150 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34151 *ret_copy = ErrorAction_ignore_duplicate_gossip();
34152 uintptr_t ret_ref = (uintptr_t)ret_copy;
34156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
34157 LDKErrorMessage msg_conv;
34158 msg_conv.inner = (void*)(msg & (~1));
34159 msg_conv.is_owned = (msg & 1) || (msg == 0);
34160 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34161 msg_conv = ErrorMessage_clone(&msg_conv);
34162 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34163 *ret_copy = ErrorAction_send_error_message(msg_conv);
34164 uintptr_t ret_ref = (uintptr_t)ret_copy;
34168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
34169 LDKWarningMessage msg_conv;
34170 msg_conv.inner = (void*)(msg & (~1));
34171 msg_conv.is_owned = (msg & 1) || (msg == 0);
34172 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34173 msg_conv = WarningMessage_clone(&msg_conv);
34174 LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
34175 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34176 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
34177 uintptr_t ret_ref = (uintptr_t)ret_copy;
34181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34182 LDKLightningError this_obj_conv;
34183 this_obj_conv.inner = (void*)(this_obj & (~1));
34184 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34186 LightningError_free(this_obj_conv);
34189 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
34190 LDKLightningError this_ptr_conv;
34191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34192 this_ptr_conv.is_owned = false;
34193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34194 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
34195 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
34200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
34201 LDKLightningError this_ptr_conv;
34202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34203 this_ptr_conv.is_owned = false;
34204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34205 LDKStr val_conv = java_to_owned_str(env, val);
34206 LightningError_set_err(&this_ptr_conv, val_conv);
34209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
34210 LDKLightningError this_ptr_conv;
34211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34212 this_ptr_conv.is_owned = false;
34213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34214 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34215 *ret_copy = LightningError_get_action(&this_ptr_conv);
34216 uintptr_t ret_ref = (uintptr_t)ret_copy;
34220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34221 LDKLightningError this_ptr_conv;
34222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34223 this_ptr_conv.is_owned = false;
34224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34225 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
34226 CHECK_ACCESS(val_ptr);
34227 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
34228 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
34229 LightningError_set_action(&this_ptr_conv, val_conv);
34232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
34233 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
34234 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
34235 CHECK_ACCESS(action_arg_ptr);
34236 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
34237 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
34238 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
34239 uintptr_t ret_ref = 0;
34240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34243 ret_ref = (uintptr_t)ret_var.inner;
34244 if (ret_var.is_owned) {
34250 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
34251 LDKLightningError ret_var = LightningError_clone(arg);
34252 uintptr_t ret_ref = 0;
34253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34256 ret_ref = (uintptr_t)ret_var.inner;
34257 if (ret_var.is_owned) {
34262 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34263 LDKLightningError arg_conv;
34264 arg_conv.inner = (void*)(arg & (~1));
34265 arg_conv.is_owned = false;
34266 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34267 intptr_t ret_val = LightningError_clone_ptr(&arg_conv);
34271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34272 LDKLightningError orig_conv;
34273 orig_conv.inner = (void*)(orig & (~1));
34274 orig_conv.is_owned = false;
34275 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34276 LDKLightningError ret_var = LightningError_clone(&orig_conv);
34277 uintptr_t ret_ref = 0;
34278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34281 ret_ref = (uintptr_t)ret_var.inner;
34282 if (ret_var.is_owned) {
34288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34289 LDKCommitmentUpdate this_obj_conv;
34290 this_obj_conv.inner = (void*)(this_obj & (~1));
34291 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34293 CommitmentUpdate_free(this_obj_conv);
34296 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34297 LDKCommitmentUpdate this_ptr_conv;
34298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34299 this_ptr_conv.is_owned = false;
34300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34301 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
34302 int64_tArray ret_arr = NULL;
34303 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34304 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34305 for (size_t p = 0; p < ret_var.datalen; p++) {
34306 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
34307 uintptr_t ret_conv_15_ref = 0;
34308 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34309 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34310 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
34311 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
34312 if (ret_conv_15_var.is_owned) {
34313 ret_conv_15_ref |= 1;
34315 ret_arr_ptr[p] = ret_conv_15_ref;
34317 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34318 FREE(ret_var.data);
34322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34323 LDKCommitmentUpdate this_ptr_conv;
34324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34325 this_ptr_conv.is_owned = false;
34326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34327 LDKCVec_UpdateAddHTLCZ val_constr;
34328 val_constr.datalen = (*env)->GetArrayLength(env, val);
34329 if (val_constr.datalen > 0)
34330 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
34332 val_constr.data = NULL;
34333 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34334 for (size_t p = 0; p < val_constr.datalen; p++) {
34335 int64_t val_conv_15 = val_vals[p];
34336 LDKUpdateAddHTLC val_conv_15_conv;
34337 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
34338 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
34339 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
34340 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
34341 val_constr.data[p] = val_conv_15_conv;
34343 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34344 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
34347 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34348 LDKCommitmentUpdate this_ptr_conv;
34349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34350 this_ptr_conv.is_owned = false;
34351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34352 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
34353 int64_tArray ret_arr = NULL;
34354 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34355 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34356 for (size_t t = 0; t < ret_var.datalen; t++) {
34357 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
34358 uintptr_t ret_conv_19_ref = 0;
34359 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34360 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
34362 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
34363 if (ret_conv_19_var.is_owned) {
34364 ret_conv_19_ref |= 1;
34366 ret_arr_ptr[t] = ret_conv_19_ref;
34368 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34369 FREE(ret_var.data);
34373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34374 LDKCommitmentUpdate this_ptr_conv;
34375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34376 this_ptr_conv.is_owned = false;
34377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34378 LDKCVec_UpdateFulfillHTLCZ val_constr;
34379 val_constr.datalen = (*env)->GetArrayLength(env, val);
34380 if (val_constr.datalen > 0)
34381 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
34383 val_constr.data = NULL;
34384 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34385 for (size_t t = 0; t < val_constr.datalen; t++) {
34386 int64_t val_conv_19 = val_vals[t];
34387 LDKUpdateFulfillHTLC val_conv_19_conv;
34388 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
34389 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
34390 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
34391 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
34392 val_constr.data[t] = val_conv_19_conv;
34394 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34395 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
34398 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34399 LDKCommitmentUpdate this_ptr_conv;
34400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34401 this_ptr_conv.is_owned = false;
34402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34403 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
34404 int64_tArray ret_arr = NULL;
34405 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34406 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34407 for (size_t q = 0; q < ret_var.datalen; q++) {
34408 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
34409 uintptr_t ret_conv_16_ref = 0;
34410 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34411 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34412 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34413 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
34414 if (ret_conv_16_var.is_owned) {
34415 ret_conv_16_ref |= 1;
34417 ret_arr_ptr[q] = ret_conv_16_ref;
34419 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34420 FREE(ret_var.data);
34424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34425 LDKCommitmentUpdate this_ptr_conv;
34426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34427 this_ptr_conv.is_owned = false;
34428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34429 LDKCVec_UpdateFailHTLCZ val_constr;
34430 val_constr.datalen = (*env)->GetArrayLength(env, val);
34431 if (val_constr.datalen > 0)
34432 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
34434 val_constr.data = NULL;
34435 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34436 for (size_t q = 0; q < val_constr.datalen; q++) {
34437 int64_t val_conv_16 = val_vals[q];
34438 LDKUpdateFailHTLC val_conv_16_conv;
34439 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
34440 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
34441 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
34442 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
34443 val_constr.data[q] = val_conv_16_conv;
34445 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34446 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
34449 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34450 LDKCommitmentUpdate this_ptr_conv;
34451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34452 this_ptr_conv.is_owned = false;
34453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34454 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
34455 int64_tArray ret_arr = NULL;
34456 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34457 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34458 for (size_t z = 0; z < ret_var.datalen; z++) {
34459 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
34460 uintptr_t ret_conv_25_ref = 0;
34461 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34462 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
34464 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
34465 if (ret_conv_25_var.is_owned) {
34466 ret_conv_25_ref |= 1;
34468 ret_arr_ptr[z] = ret_conv_25_ref;
34470 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34471 FREE(ret_var.data);
34475 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) {
34476 LDKCommitmentUpdate this_ptr_conv;
34477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34478 this_ptr_conv.is_owned = false;
34479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34480 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
34481 val_constr.datalen = (*env)->GetArrayLength(env, val);
34482 if (val_constr.datalen > 0)
34483 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
34485 val_constr.data = NULL;
34486 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34487 for (size_t z = 0; z < val_constr.datalen; z++) {
34488 int64_t val_conv_25 = val_vals[z];
34489 LDKUpdateFailMalformedHTLC val_conv_25_conv;
34490 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
34491 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
34492 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
34493 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
34494 val_constr.data[z] = val_conv_25_conv;
34496 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34497 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
34500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
34501 LDKCommitmentUpdate this_ptr_conv;
34502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34503 this_ptr_conv.is_owned = false;
34504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34505 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
34506 uintptr_t ret_ref = 0;
34507 if ((uintptr_t)ret_var.inner > 4096) {
34508 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34509 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34510 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34511 ret_ref = (uintptr_t)ret_var.inner;
34512 if (ret_var.is_owned) {
34519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34520 LDKCommitmentUpdate this_ptr_conv;
34521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34522 this_ptr_conv.is_owned = false;
34523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34524 LDKUpdateFee val_conv;
34525 val_conv.inner = (void*)(val & (~1));
34526 val_conv.is_owned = (val & 1) || (val == 0);
34527 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34528 val_conv = UpdateFee_clone(&val_conv);
34529 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
34532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
34533 LDKCommitmentUpdate this_ptr_conv;
34534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34535 this_ptr_conv.is_owned = false;
34536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34537 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
34538 uintptr_t ret_ref = 0;
34539 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34540 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34542 ret_ref = (uintptr_t)ret_var.inner;
34543 if (ret_var.is_owned) {
34549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34550 LDKCommitmentUpdate this_ptr_conv;
34551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34552 this_ptr_conv.is_owned = false;
34553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34554 LDKCommitmentSigned val_conv;
34555 val_conv.inner = (void*)(val & (~1));
34556 val_conv.is_owned = (val & 1) || (val == 0);
34557 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34558 val_conv = CommitmentSigned_clone(&val_conv);
34559 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
34562 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) {
34563 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
34564 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
34565 if (update_add_htlcs_arg_constr.datalen > 0)
34566 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
34568 update_add_htlcs_arg_constr.data = NULL;
34569 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
34570 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
34571 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
34572 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
34573 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
34574 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
34575 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
34576 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
34577 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
34579 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
34580 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
34581 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
34582 if (update_fulfill_htlcs_arg_constr.datalen > 0)
34583 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
34585 update_fulfill_htlcs_arg_constr.data = NULL;
34586 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
34587 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
34588 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
34589 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
34590 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
34591 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
34592 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
34593 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
34594 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
34596 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
34597 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
34598 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
34599 if (update_fail_htlcs_arg_constr.datalen > 0)
34600 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
34602 update_fail_htlcs_arg_constr.data = NULL;
34603 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
34604 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
34605 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
34606 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
34607 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
34608 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
34609 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
34610 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
34611 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
34613 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
34614 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
34615 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
34616 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
34617 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
34619 update_fail_malformed_htlcs_arg_constr.data = NULL;
34620 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
34621 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
34622 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
34623 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
34624 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
34625 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);
34626 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
34627 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
34628 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
34630 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
34631 LDKUpdateFee update_fee_arg_conv;
34632 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
34633 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
34634 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
34635 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
34636 LDKCommitmentSigned commitment_signed_arg_conv;
34637 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
34638 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
34639 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
34640 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
34641 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);
34642 uintptr_t ret_ref = 0;
34643 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34644 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34646 ret_ref = (uintptr_t)ret_var.inner;
34647 if (ret_var.is_owned) {
34653 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
34654 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
34655 uintptr_t ret_ref = 0;
34656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34659 ret_ref = (uintptr_t)ret_var.inner;
34660 if (ret_var.is_owned) {
34665 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34666 LDKCommitmentUpdate arg_conv;
34667 arg_conv.inner = (void*)(arg & (~1));
34668 arg_conv.is_owned = false;
34669 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34670 intptr_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
34674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34675 LDKCommitmentUpdate orig_conv;
34676 orig_conv.inner = (void*)(orig & (~1));
34677 orig_conv.is_owned = false;
34678 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34679 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
34680 uintptr_t ret_ref = 0;
34681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34684 ret_ref = (uintptr_t)ret_var.inner;
34685 if (ret_var.is_owned) {
34691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34692 if ((this_ptr & 1) != 0) return;
34693 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34694 CHECK_ACCESS(this_ptr_ptr);
34695 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
34696 FREE((void*)this_ptr);
34697 ChannelMessageHandler_free(this_ptr_conv);
34700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34701 if ((this_ptr & 1) != 0) return;
34702 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34703 CHECK_ACCESS(this_ptr_ptr);
34704 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
34705 FREE((void*)this_ptr);
34706 RoutingMessageHandler_free(this_ptr_conv);
34709 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
34710 LDKAcceptChannel obj_conv;
34711 obj_conv.inner = (void*)(obj & (~1));
34712 obj_conv.is_owned = false;
34713 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34714 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
34715 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34716 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34717 CVec_u8Z_free(ret_var);
34721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34722 LDKu8slice ser_ref;
34723 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34724 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34725 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
34726 *ret_conv = AcceptChannel_read(ser_ref);
34727 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34728 return (uintptr_t)ret_conv;
34731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
34732 LDKAnnouncementSignatures obj_conv;
34733 obj_conv.inner = (void*)(obj & (~1));
34734 obj_conv.is_owned = false;
34735 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34736 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
34737 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34738 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34739 CVec_u8Z_free(ret_var);
34743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34744 LDKu8slice ser_ref;
34745 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34746 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34747 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34748 *ret_conv = AnnouncementSignatures_read(ser_ref);
34749 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34750 return (uintptr_t)ret_conv;
34753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
34754 LDKChannelReestablish obj_conv;
34755 obj_conv.inner = (void*)(obj & (~1));
34756 obj_conv.is_owned = false;
34757 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34758 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
34759 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34760 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34761 CVec_u8Z_free(ret_var);
34765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34766 LDKu8slice ser_ref;
34767 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34768 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34769 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34770 *ret_conv = ChannelReestablish_read(ser_ref);
34771 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34772 return (uintptr_t)ret_conv;
34775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
34776 LDKClosingSigned obj_conv;
34777 obj_conv.inner = (void*)(obj & (~1));
34778 obj_conv.is_owned = false;
34779 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34780 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
34781 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34782 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34783 CVec_u8Z_free(ret_var);
34787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34788 LDKu8slice ser_ref;
34789 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34790 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34791 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34792 *ret_conv = ClosingSigned_read(ser_ref);
34793 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34794 return (uintptr_t)ret_conv;
34797 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
34798 LDKClosingSignedFeeRange obj_conv;
34799 obj_conv.inner = (void*)(obj & (~1));
34800 obj_conv.is_owned = false;
34801 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34802 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
34803 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34804 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34805 CVec_u8Z_free(ret_var);
34809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34810 LDKu8slice ser_ref;
34811 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34812 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34813 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34814 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
34815 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34816 return (uintptr_t)ret_conv;
34819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
34820 LDKCommitmentSigned obj_conv;
34821 obj_conv.inner = (void*)(obj & (~1));
34822 obj_conv.is_owned = false;
34823 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34824 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
34825 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34826 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34827 CVec_u8Z_free(ret_var);
34831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34832 LDKu8slice ser_ref;
34833 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34834 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34835 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34836 *ret_conv = CommitmentSigned_read(ser_ref);
34837 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34838 return (uintptr_t)ret_conv;
34841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
34842 LDKFundingCreated obj_conv;
34843 obj_conv.inner = (void*)(obj & (~1));
34844 obj_conv.is_owned = false;
34845 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34846 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
34847 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34848 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34849 CVec_u8Z_free(ret_var);
34853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34854 LDKu8slice ser_ref;
34855 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34856 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34857 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34858 *ret_conv = FundingCreated_read(ser_ref);
34859 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34860 return (uintptr_t)ret_conv;
34863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
34864 LDKFundingSigned obj_conv;
34865 obj_conv.inner = (void*)(obj & (~1));
34866 obj_conv.is_owned = false;
34867 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34868 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
34869 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34870 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34871 CVec_u8Z_free(ret_var);
34875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34876 LDKu8slice ser_ref;
34877 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34878 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34879 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34880 *ret_conv = FundingSigned_read(ser_ref);
34881 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34882 return (uintptr_t)ret_conv;
34885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
34886 LDKFundingLocked obj_conv;
34887 obj_conv.inner = (void*)(obj & (~1));
34888 obj_conv.is_owned = false;
34889 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34890 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
34891 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34892 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34893 CVec_u8Z_free(ret_var);
34897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34898 LDKu8slice ser_ref;
34899 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34900 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34901 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
34902 *ret_conv = FundingLocked_read(ser_ref);
34903 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34904 return (uintptr_t)ret_conv;
34907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
34909 obj_conv.inner = (void*)(obj & (~1));
34910 obj_conv.is_owned = false;
34911 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34912 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
34913 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34914 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34915 CVec_u8Z_free(ret_var);
34919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34920 LDKu8slice ser_ref;
34921 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34922 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34923 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34924 *ret_conv = Init_read(ser_ref);
34925 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34926 return (uintptr_t)ret_conv;
34929 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
34930 LDKOpenChannel obj_conv;
34931 obj_conv.inner = (void*)(obj & (~1));
34932 obj_conv.is_owned = false;
34933 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34934 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
34935 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34936 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34937 CVec_u8Z_free(ret_var);
34941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34942 LDKu8slice ser_ref;
34943 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34944 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34945 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34946 *ret_conv = OpenChannel_read(ser_ref);
34947 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34948 return (uintptr_t)ret_conv;
34951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
34952 LDKRevokeAndACK obj_conv;
34953 obj_conv.inner = (void*)(obj & (~1));
34954 obj_conv.is_owned = false;
34955 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34956 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
34957 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34958 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34959 CVec_u8Z_free(ret_var);
34963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34964 LDKu8slice ser_ref;
34965 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34966 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34967 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34968 *ret_conv = RevokeAndACK_read(ser_ref);
34969 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34970 return (uintptr_t)ret_conv;
34973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
34974 LDKShutdown obj_conv;
34975 obj_conv.inner = (void*)(obj & (~1));
34976 obj_conv.is_owned = false;
34977 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34978 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
34979 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34980 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34981 CVec_u8Z_free(ret_var);
34985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34986 LDKu8slice ser_ref;
34987 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34988 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34989 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
34990 *ret_conv = Shutdown_read(ser_ref);
34991 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34992 return (uintptr_t)ret_conv;
34995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
34996 LDKUpdateFailHTLC obj_conv;
34997 obj_conv.inner = (void*)(obj & (~1));
34998 obj_conv.is_owned = false;
34999 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35000 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
35001 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35002 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35003 CVec_u8Z_free(ret_var);
35007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35008 LDKu8slice ser_ref;
35009 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35010 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35011 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35012 *ret_conv = UpdateFailHTLC_read(ser_ref);
35013 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35014 return (uintptr_t)ret_conv;
35017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35018 LDKUpdateFailMalformedHTLC obj_conv;
35019 obj_conv.inner = (void*)(obj & (~1));
35020 obj_conv.is_owned = false;
35021 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35022 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
35023 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35024 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35025 CVec_u8Z_free(ret_var);
35029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35030 LDKu8slice ser_ref;
35031 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35032 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35033 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35034 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
35035 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35036 return (uintptr_t)ret_conv;
35039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
35040 LDKUpdateFee obj_conv;
35041 obj_conv.inner = (void*)(obj & (~1));
35042 obj_conv.is_owned = false;
35043 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35044 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
35045 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35046 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35047 CVec_u8Z_free(ret_var);
35051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35052 LDKu8slice ser_ref;
35053 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35054 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35055 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35056 *ret_conv = UpdateFee_read(ser_ref);
35057 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35058 return (uintptr_t)ret_conv;
35061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35062 LDKUpdateFulfillHTLC obj_conv;
35063 obj_conv.inner = (void*)(obj & (~1));
35064 obj_conv.is_owned = false;
35065 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35066 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
35067 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35068 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35069 CVec_u8Z_free(ret_var);
35073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35074 LDKu8slice ser_ref;
35075 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35076 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35077 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35078 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
35079 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35080 return (uintptr_t)ret_conv;
35083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35084 LDKUpdateAddHTLC obj_conv;
35085 obj_conv.inner = (void*)(obj & (~1));
35086 obj_conv.is_owned = false;
35087 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35088 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
35089 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35090 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35091 CVec_u8Z_free(ret_var);
35095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35096 LDKu8slice ser_ref;
35097 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35098 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35099 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35100 *ret_conv = UpdateAddHTLC_read(ser_ref);
35101 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35102 return (uintptr_t)ret_conv;
35105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
35107 obj_conv.inner = (void*)(obj & (~1));
35108 obj_conv.is_owned = false;
35109 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35110 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
35111 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35112 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35113 CVec_u8Z_free(ret_var);
35117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35118 LDKu8slice ser_ref;
35119 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35120 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35121 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35122 *ret_conv = Ping_read(ser_ref);
35123 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35124 return (uintptr_t)ret_conv;
35127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
35129 obj_conv.inner = (void*)(obj & (~1));
35130 obj_conv.is_owned = false;
35131 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35132 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
35133 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35134 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35135 CVec_u8Z_free(ret_var);
35139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35140 LDKu8slice ser_ref;
35141 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35142 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35143 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35144 *ret_conv = Pong_read(ser_ref);
35145 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35146 return (uintptr_t)ret_conv;
35149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35150 LDKUnsignedChannelAnnouncement obj_conv;
35151 obj_conv.inner = (void*)(obj & (~1));
35152 obj_conv.is_owned = false;
35153 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35154 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
35155 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35156 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35157 CVec_u8Z_free(ret_var);
35161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35162 LDKu8slice ser_ref;
35163 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35164 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35165 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35166 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
35167 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35168 return (uintptr_t)ret_conv;
35171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35172 LDKChannelAnnouncement obj_conv;
35173 obj_conv.inner = (void*)(obj & (~1));
35174 obj_conv.is_owned = false;
35175 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35176 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
35177 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35178 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35179 CVec_u8Z_free(ret_var);
35183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35184 LDKu8slice ser_ref;
35185 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35186 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35187 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35188 *ret_conv = ChannelAnnouncement_read(ser_ref);
35189 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35190 return (uintptr_t)ret_conv;
35193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35194 LDKUnsignedChannelUpdate obj_conv;
35195 obj_conv.inner = (void*)(obj & (~1));
35196 obj_conv.is_owned = false;
35197 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35198 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
35199 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35200 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35201 CVec_u8Z_free(ret_var);
35205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35206 LDKu8slice ser_ref;
35207 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35208 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35209 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35210 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
35211 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35212 return (uintptr_t)ret_conv;
35215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35216 LDKChannelUpdate obj_conv;
35217 obj_conv.inner = (void*)(obj & (~1));
35218 obj_conv.is_owned = false;
35219 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35220 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
35221 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35222 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35223 CVec_u8Z_free(ret_var);
35227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35228 LDKu8slice ser_ref;
35229 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35230 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35231 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35232 *ret_conv = ChannelUpdate_read(ser_ref);
35233 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35234 return (uintptr_t)ret_conv;
35237 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
35238 LDKErrorMessage obj_conv;
35239 obj_conv.inner = (void*)(obj & (~1));
35240 obj_conv.is_owned = false;
35241 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35242 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
35243 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35244 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35245 CVec_u8Z_free(ret_var);
35249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35250 LDKu8slice ser_ref;
35251 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35252 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35253 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35254 *ret_conv = ErrorMessage_read(ser_ref);
35255 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35256 return (uintptr_t)ret_conv;
35259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
35260 LDKWarningMessage obj_conv;
35261 obj_conv.inner = (void*)(obj & (~1));
35262 obj_conv.is_owned = false;
35263 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35264 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
35265 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35266 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35267 CVec_u8Z_free(ret_var);
35271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35272 LDKu8slice ser_ref;
35273 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35274 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35275 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35276 *ret_conv = WarningMessage_read(ser_ref);
35277 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35278 return (uintptr_t)ret_conv;
35281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35282 LDKUnsignedNodeAnnouncement obj_conv;
35283 obj_conv.inner = (void*)(obj & (~1));
35284 obj_conv.is_owned = false;
35285 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35286 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
35287 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35288 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35289 CVec_u8Z_free(ret_var);
35293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35294 LDKu8slice ser_ref;
35295 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35296 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35297 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35298 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
35299 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35300 return (uintptr_t)ret_conv;
35303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35304 LDKNodeAnnouncement obj_conv;
35305 obj_conv.inner = (void*)(obj & (~1));
35306 obj_conv.is_owned = false;
35307 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35308 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
35309 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35310 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35311 CVec_u8Z_free(ret_var);
35315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35316 LDKu8slice ser_ref;
35317 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35318 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35319 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
35320 *ret_conv = NodeAnnouncement_read(ser_ref);
35321 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35322 return (uintptr_t)ret_conv;
35325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35326 LDKu8slice ser_ref;
35327 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35328 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35329 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
35330 *ret_conv = QueryShortChannelIds_read(ser_ref);
35331 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35332 return (uintptr_t)ret_conv;
35335 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
35336 LDKQueryShortChannelIds obj_conv;
35337 obj_conv.inner = (void*)(obj & (~1));
35338 obj_conv.is_owned = false;
35339 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35340 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
35341 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35342 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35343 CVec_u8Z_free(ret_var);
35347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
35348 LDKReplyShortChannelIdsEnd obj_conv;
35349 obj_conv.inner = (void*)(obj & (~1));
35350 obj_conv.is_owned = false;
35351 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35352 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
35353 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35354 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35355 CVec_u8Z_free(ret_var);
35359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35360 LDKu8slice ser_ref;
35361 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35362 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35363 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
35364 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
35365 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35366 return (uintptr_t)ret_conv;
35369 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
35370 LDKQueryChannelRange this_arg_conv;
35371 this_arg_conv.inner = (void*)(this_arg & (~1));
35372 this_arg_conv.is_owned = false;
35373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35374 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
35378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
35379 LDKQueryChannelRange obj_conv;
35380 obj_conv.inner = (void*)(obj & (~1));
35381 obj_conv.is_owned = false;
35382 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35383 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
35384 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35385 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35386 CVec_u8Z_free(ret_var);
35390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35391 LDKu8slice ser_ref;
35392 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35393 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35394 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
35395 *ret_conv = QueryChannelRange_read(ser_ref);
35396 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35397 return (uintptr_t)ret_conv;
35400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35401 LDKu8slice ser_ref;
35402 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35403 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35404 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
35405 *ret_conv = ReplyChannelRange_read(ser_ref);
35406 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35407 return (uintptr_t)ret_conv;
35410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
35411 LDKReplyChannelRange obj_conv;
35412 obj_conv.inner = (void*)(obj & (~1));
35413 obj_conv.is_owned = false;
35414 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35415 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
35416 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35417 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35418 CVec_u8Z_free(ret_var);
35422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
35423 LDKGossipTimestampFilter obj_conv;
35424 obj_conv.inner = (void*)(obj & (~1));
35425 obj_conv.is_owned = false;
35426 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35427 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
35428 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35429 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35430 CVec_u8Z_free(ret_var);
35434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35435 LDKu8slice ser_ref;
35436 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35437 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35438 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
35439 *ret_conv = GossipTimestampFilter_read(ser_ref);
35440 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35441 return (uintptr_t)ret_conv;
35444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35445 if ((this_ptr & 1) != 0) return;
35446 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35447 CHECK_ACCESS(this_ptr_ptr);
35448 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
35449 FREE((void*)this_ptr);
35450 CustomMessageHandler_free(this_ptr_conv);
35453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35454 LDKIgnoringMessageHandler this_obj_conv;
35455 this_obj_conv.inner = (void*)(this_obj & (~1));
35456 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35458 IgnoringMessageHandler_free(this_obj_conv);
35461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
35462 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
35463 uintptr_t ret_ref = 0;
35464 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35465 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35467 ret_ref = (uintptr_t)ret_var.inner;
35468 if (ret_var.is_owned) {
35474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
35475 LDKIgnoringMessageHandler this_arg_conv;
35476 this_arg_conv.inner = (void*)(this_arg & (~1));
35477 this_arg_conv.is_owned = false;
35478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35479 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35480 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
35481 return (uintptr_t)ret_ret;
35484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
35485 LDKIgnoringMessageHandler this_arg_conv;
35486 this_arg_conv.inner = (void*)(this_arg & (~1));
35487 this_arg_conv.is_owned = false;
35488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35489 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
35490 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
35491 return (uintptr_t)ret_ret;
35494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
35495 LDKIgnoringMessageHandler this_arg_conv;
35496 this_arg_conv.inner = (void*)(this_arg & (~1));
35497 this_arg_conv.is_owned = false;
35498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35499 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
35500 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
35501 return (uintptr_t)ret_ret;
35504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
35505 LDKIgnoringMessageHandler this_arg_conv;
35506 this_arg_conv.inner = (void*)(this_arg & (~1));
35507 this_arg_conv.is_owned = false;
35508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35509 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
35510 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
35511 return (uintptr_t)ret_ret;
35514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35515 LDKErroringMessageHandler this_obj_conv;
35516 this_obj_conv.inner = (void*)(this_obj & (~1));
35517 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35519 ErroringMessageHandler_free(this_obj_conv);
35522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
35523 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
35524 uintptr_t ret_ref = 0;
35525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35528 ret_ref = (uintptr_t)ret_var.inner;
35529 if (ret_var.is_owned) {
35535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
35536 LDKErroringMessageHandler this_arg_conv;
35537 this_arg_conv.inner = (void*)(this_arg & (~1));
35538 this_arg_conv.is_owned = false;
35539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35540 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35541 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
35542 return (uintptr_t)ret_ret;
35545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
35546 LDKErroringMessageHandler this_arg_conv;
35547 this_arg_conv.inner = (void*)(this_arg & (~1));
35548 this_arg_conv.is_owned = false;
35549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35550 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
35551 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
35552 return (uintptr_t)ret_ret;
35555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35556 LDKMessageHandler this_obj_conv;
35557 this_obj_conv.inner = (void*)(this_obj & (~1));
35558 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35560 MessageHandler_free(this_obj_conv);
35563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
35564 LDKMessageHandler this_ptr_conv;
35565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35566 this_ptr_conv.is_owned = false;
35567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35568 // WARNING: This object doesn't live past this scope, needs clone!
35569 uintptr_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
35573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35574 LDKMessageHandler this_ptr_conv;
35575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35576 this_ptr_conv.is_owned = false;
35577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35578 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
35579 CHECK_ACCESS(val_ptr);
35580 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
35581 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
35582 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35583 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
35585 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
35588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
35589 LDKMessageHandler this_ptr_conv;
35590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35591 this_ptr_conv.is_owned = false;
35592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35593 // WARNING: This object doesn't live past this scope, needs clone!
35594 uintptr_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
35598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35599 LDKMessageHandler this_ptr_conv;
35600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35601 this_ptr_conv.is_owned = false;
35602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35603 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
35604 CHECK_ACCESS(val_ptr);
35605 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
35606 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
35607 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35608 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
35610 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
35613 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) {
35614 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
35615 CHECK_ACCESS(chan_handler_arg_ptr);
35616 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
35617 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
35618 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35619 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
35621 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
35622 CHECK_ACCESS(route_handler_arg_ptr);
35623 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
35624 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
35625 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35626 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
35628 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
35629 uintptr_t ret_ref = 0;
35630 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35631 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35633 ret_ref = (uintptr_t)ret_var.inner;
35634 if (ret_var.is_owned) {
35640 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
35641 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
35642 *ret_ret = SocketDescriptor_clone(arg);
35643 return (uintptr_t)ret_ret;
35645 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35646 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
35647 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
35648 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
35649 intptr_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
35653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35654 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
35655 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
35656 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
35657 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
35658 *ret_ret = SocketDescriptor_clone(orig_conv);
35659 return (uintptr_t)ret_ret;
35662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35663 if ((this_ptr & 1) != 0) return;
35664 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35665 CHECK_ACCESS(this_ptr_ptr);
35666 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
35667 FREE((void*)this_ptr);
35668 SocketDescriptor_free(this_ptr_conv);
35671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35672 LDKPeerHandleError this_obj_conv;
35673 this_obj_conv.inner = (void*)(this_obj & (~1));
35674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35676 PeerHandleError_free(this_obj_conv);
35679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
35680 LDKPeerHandleError this_ptr_conv;
35681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35682 this_ptr_conv.is_owned = false;
35683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35684 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
35688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35689 LDKPeerHandleError this_ptr_conv;
35690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35691 this_ptr_conv.is_owned = false;
35692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35693 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
35696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
35697 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
35698 uintptr_t ret_ref = 0;
35699 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35700 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35702 ret_ref = (uintptr_t)ret_var.inner;
35703 if (ret_var.is_owned) {
35709 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
35710 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
35711 uintptr_t ret_ref = 0;
35712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35715 ret_ref = (uintptr_t)ret_var.inner;
35716 if (ret_var.is_owned) {
35721 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35722 LDKPeerHandleError arg_conv;
35723 arg_conv.inner = (void*)(arg & (~1));
35724 arg_conv.is_owned = false;
35725 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35726 intptr_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
35730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35731 LDKPeerHandleError orig_conv;
35732 orig_conv.inner = (void*)(orig & (~1));
35733 orig_conv.is_owned = false;
35734 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35735 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
35736 uintptr_t ret_ref = 0;
35737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35740 ret_ref = (uintptr_t)ret_var.inner;
35741 if (ret_var.is_owned) {
35747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35748 LDKPeerManager this_obj_conv;
35749 this_obj_conv.inner = (void*)(this_obj & (~1));
35750 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35752 PeerManager_free(this_obj_conv);
35755 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) {
35756 LDKMessageHandler message_handler_conv;
35757 message_handler_conv.inner = (void*)(message_handler & (~1));
35758 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
35759 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
35760 // WARNING: we need a move here but no clone is available for LDKMessageHandler
35761 LDKSecretKey our_node_secret_ref;
35762 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
35763 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
35764 unsigned char ephemeral_random_data_arr[32];
35765 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
35766 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
35767 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
35768 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
35769 CHECK_ACCESS(logger_ptr);
35770 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35771 if (logger_conv.free == LDKLogger_JCalls_free) {
35772 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35773 LDKLogger_JCalls_cloned(&logger_conv);
35775 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
35776 CHECK_ACCESS(custom_message_handler_ptr);
35777 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
35778 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
35779 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35780 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
35782 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
35783 uintptr_t ret_ref = 0;
35784 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35785 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35787 ret_ref = (uintptr_t)ret_var.inner;
35788 if (ret_var.is_owned) {
35794 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
35795 LDKPeerManager this_arg_conv;
35796 this_arg_conv.inner = (void*)(this_arg & (~1));
35797 this_arg_conv.is_owned = false;
35798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35799 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
35800 jobjectArray ret_arr = NULL;
35801 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
35803 for (size_t i = 0; i < ret_var.datalen; i++) {
35804 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
35805 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
35806 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
35809 FREE(ret_var.data);
35813 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) {
35814 LDKPeerManager this_arg_conv;
35815 this_arg_conv.inner = (void*)(this_arg & (~1));
35816 this_arg_conv.is_owned = false;
35817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35818 LDKPublicKey their_node_id_ref;
35819 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
35820 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
35821 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
35822 CHECK_ACCESS(descriptor_ptr);
35823 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
35824 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
35825 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35826 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
35828 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
35829 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
35830 return (uintptr_t)ret_conv;
35833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
35834 LDKPeerManager this_arg_conv;
35835 this_arg_conv.inner = (void*)(this_arg & (~1));
35836 this_arg_conv.is_owned = false;
35837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35838 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
35839 CHECK_ACCESS(descriptor_ptr);
35840 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
35841 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
35842 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35843 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
35845 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
35846 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
35847 return (uintptr_t)ret_conv;
35850 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) {
35851 LDKPeerManager this_arg_conv;
35852 this_arg_conv.inner = (void*)(this_arg & (~1));
35853 this_arg_conv.is_owned = false;
35854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35855 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
35856 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
35857 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
35858 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
35859 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
35860 return (uintptr_t)ret_conv;
35863 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) {
35864 LDKPeerManager this_arg_conv;
35865 this_arg_conv.inner = (void*)(this_arg & (~1));
35866 this_arg_conv.is_owned = false;
35867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35868 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
35869 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
35870 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
35871 LDKu8slice data_ref;
35872 data_ref.datalen = (*env)->GetArrayLength(env, data);
35873 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
35874 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
35875 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
35876 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
35877 return (uintptr_t)ret_conv;
35880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
35881 LDKPeerManager 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 PeerManager_process_events(&this_arg_conv);
35888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
35889 LDKPeerManager this_arg_conv;
35890 this_arg_conv.inner = (void*)(this_arg & (~1));
35891 this_arg_conv.is_owned = false;
35892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35893 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
35894 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
35895 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
35896 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
35899 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) {
35900 LDKPeerManager this_arg_conv;
35901 this_arg_conv.inner = (void*)(this_arg & (~1));
35902 this_arg_conv.is_owned = false;
35903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35904 LDKPublicKey node_id_ref;
35905 CHECK((*env)->GetArrayLength(env, node_id) == 33);
35906 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
35907 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
35910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
35911 LDKPeerManager 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 PeerManager_disconnect_all_peers(&this_arg_conv);
35918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
35919 LDKPeerManager this_arg_conv;
35920 this_arg_conv.inner = (void*)(this_arg & (~1));
35921 this_arg_conv.is_owned = false;
35922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35923 PeerManager_timer_tick_occurred(&this_arg_conv);
35926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
35927 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
35931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
35932 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
35936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
35937 unsigned char commitment_seed_arr[32];
35938 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
35939 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
35940 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
35941 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35942 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
35946 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) {
35947 LDKCVec_u8Z to_holder_script_ref;
35948 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
35949 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35950 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
35951 LDKCVec_u8Z to_counterparty_script_ref;
35952 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
35953 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35954 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
35955 LDKOutPoint funding_outpoint_conv;
35956 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
35957 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
35958 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35959 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35960 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);
35961 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35962 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35963 Transaction_free(ret_var);
35967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35968 LDKCounterpartyCommitmentSecrets this_obj_conv;
35969 this_obj_conv.inner = (void*)(this_obj & (~1));
35970 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35972 CounterpartyCommitmentSecrets_free(this_obj_conv);
35975 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
35976 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
35977 uintptr_t ret_ref = 0;
35978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35981 ret_ref = (uintptr_t)ret_var.inner;
35982 if (ret_var.is_owned) {
35987 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35988 LDKCounterpartyCommitmentSecrets arg_conv;
35989 arg_conv.inner = (void*)(arg & (~1));
35990 arg_conv.is_owned = false;
35991 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35992 intptr_t ret_val = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
35996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35997 LDKCounterpartyCommitmentSecrets orig_conv;
35998 orig_conv.inner = (void*)(orig & (~1));
35999 orig_conv.is_owned = false;
36000 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36001 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
36002 uintptr_t ret_ref = 0;
36003 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36004 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36006 ret_ref = (uintptr_t)ret_var.inner;
36007 if (ret_var.is_owned) {
36013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
36014 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
36015 uintptr_t ret_ref = 0;
36016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36019 ret_ref = (uintptr_t)ret_var.inner;
36020 if (ret_var.is_owned) {
36026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
36027 LDKCounterpartyCommitmentSecrets this_arg_conv;
36028 this_arg_conv.inner = (void*)(this_arg & (~1));
36029 this_arg_conv.is_owned = false;
36030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36031 int64_t ret_val = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
36035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1provide_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
36036 LDKCounterpartyCommitmentSecrets this_arg_conv;
36037 this_arg_conv.inner = (void*)(this_arg & (~1));
36038 this_arg_conv.is_owned = false;
36039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36040 LDKThirtyTwoBytes secret_ref;
36041 CHECK((*env)->GetArrayLength(env, secret) == 32);
36042 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
36043 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36044 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
36045 return (uintptr_t)ret_conv;
36048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
36049 LDKCounterpartyCommitmentSecrets this_arg_conv;
36050 this_arg_conv.inner = (void*)(this_arg & (~1));
36051 this_arg_conv.is_owned = false;
36052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36053 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36054 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
36058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
36059 LDKCounterpartyCommitmentSecrets obj_conv;
36060 obj_conv.inner = (void*)(obj & (~1));
36061 obj_conv.is_owned = false;
36062 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36063 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
36064 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36065 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36066 CVec_u8Z_free(ret_var);
36070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36071 LDKu8slice ser_ref;
36072 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36073 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36074 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36075 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
36076 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36077 return (uintptr_t)ret_conv;
36080 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) {
36081 LDKPublicKey per_commitment_point_ref;
36082 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36083 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36084 unsigned char base_secret_arr[32];
36085 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
36086 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
36087 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
36088 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36089 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
36090 return (uintptr_t)ret_conv;
36093 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) {
36094 LDKPublicKey per_commitment_point_ref;
36095 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36096 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36097 LDKPublicKey base_point_ref;
36098 CHECK((*env)->GetArrayLength(env, base_point) == 33);
36099 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
36100 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36101 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
36102 return (uintptr_t)ret_conv;
36105 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) {
36106 unsigned char per_commitment_secret_arr[32];
36107 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
36108 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
36109 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
36110 unsigned char countersignatory_revocation_base_secret_arr[32];
36111 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
36112 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
36113 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
36114 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36115 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
36116 return (uintptr_t)ret_conv;
36119 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) {
36120 LDKPublicKey per_commitment_point_ref;
36121 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36122 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36123 LDKPublicKey countersignatory_revocation_base_point_ref;
36124 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
36125 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
36126 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36127 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
36128 return (uintptr_t)ret_conv;
36131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36132 LDKTxCreationKeys this_obj_conv;
36133 this_obj_conv.inner = (void*)(this_obj & (~1));
36134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36136 TxCreationKeys_free(this_obj_conv);
36139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
36140 LDKTxCreationKeys this_ptr_conv;
36141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36142 this_ptr_conv.is_owned = false;
36143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36144 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36145 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
36149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36150 LDKTxCreationKeys this_ptr_conv;
36151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36152 this_ptr_conv.is_owned = false;
36153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36154 LDKPublicKey val_ref;
36155 CHECK((*env)->GetArrayLength(env, val) == 33);
36156 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36157 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
36160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36161 LDKTxCreationKeys this_ptr_conv;
36162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36163 this_ptr_conv.is_owned = false;
36164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36165 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36166 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
36170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36171 LDKTxCreationKeys this_ptr_conv;
36172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36173 this_ptr_conv.is_owned = false;
36174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36175 LDKPublicKey val_ref;
36176 CHECK((*env)->GetArrayLength(env, val) == 33);
36177 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36178 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
36181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36182 LDKTxCreationKeys this_ptr_conv;
36183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36184 this_ptr_conv.is_owned = false;
36185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36186 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36187 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
36191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36192 LDKTxCreationKeys this_ptr_conv;
36193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36194 this_ptr_conv.is_owned = false;
36195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36196 LDKPublicKey val_ref;
36197 CHECK((*env)->GetArrayLength(env, val) == 33);
36198 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36199 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
36202 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36203 LDKTxCreationKeys this_ptr_conv;
36204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36205 this_ptr_conv.is_owned = false;
36206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36207 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36208 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
36212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36213 LDKTxCreationKeys this_ptr_conv;
36214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36215 this_ptr_conv.is_owned = false;
36216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36217 LDKPublicKey val_ref;
36218 CHECK((*env)->GetArrayLength(env, val) == 33);
36219 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36220 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
36223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36224 LDKTxCreationKeys this_ptr_conv;
36225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36226 this_ptr_conv.is_owned = false;
36227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36228 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36229 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
36233 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) {
36234 LDKTxCreationKeys this_ptr_conv;
36235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36236 this_ptr_conv.is_owned = false;
36237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36238 LDKPublicKey val_ref;
36239 CHECK((*env)->GetArrayLength(env, val) == 33);
36240 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36241 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
36244 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) {
36245 LDKPublicKey per_commitment_point_arg_ref;
36246 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
36247 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
36248 LDKPublicKey revocation_key_arg_ref;
36249 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
36250 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
36251 LDKPublicKey broadcaster_htlc_key_arg_ref;
36252 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
36253 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
36254 LDKPublicKey countersignatory_htlc_key_arg_ref;
36255 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
36256 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
36257 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
36258 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
36259 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
36260 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);
36261 uintptr_t ret_ref = 0;
36262 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36263 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36264 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36265 ret_ref = (uintptr_t)ret_var.inner;
36266 if (ret_var.is_owned) {
36272 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
36273 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
36274 uintptr_t ret_ref = 0;
36275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36278 ret_ref = (uintptr_t)ret_var.inner;
36279 if (ret_var.is_owned) {
36284 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36285 LDKTxCreationKeys arg_conv;
36286 arg_conv.inner = (void*)(arg & (~1));
36287 arg_conv.is_owned = false;
36288 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36289 intptr_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
36293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36294 LDKTxCreationKeys orig_conv;
36295 orig_conv.inner = (void*)(orig & (~1));
36296 orig_conv.is_owned = false;
36297 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36298 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
36299 uintptr_t ret_ref = 0;
36300 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36301 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36302 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36303 ret_ref = (uintptr_t)ret_var.inner;
36304 if (ret_var.is_owned) {
36310 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
36311 LDKTxCreationKeys obj_conv;
36312 obj_conv.inner = (void*)(obj & (~1));
36313 obj_conv.is_owned = false;
36314 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36315 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
36316 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36317 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36318 CVec_u8Z_free(ret_var);
36322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36323 LDKu8slice ser_ref;
36324 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36325 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36326 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36327 *ret_conv = TxCreationKeys_read(ser_ref);
36328 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36329 return (uintptr_t)ret_conv;
36332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36333 LDKChannelPublicKeys this_obj_conv;
36334 this_obj_conv.inner = (void*)(this_obj & (~1));
36335 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36337 ChannelPublicKeys_free(this_obj_conv);
36340 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
36341 LDKChannelPublicKeys this_ptr_conv;
36342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36343 this_ptr_conv.is_owned = false;
36344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36345 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36346 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
36350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36351 LDKChannelPublicKeys this_ptr_conv;
36352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36353 this_ptr_conv.is_owned = false;
36354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36355 LDKPublicKey val_ref;
36356 CHECK((*env)->GetArrayLength(env, val) == 33);
36357 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36358 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
36361 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
36362 LDKChannelPublicKeys this_ptr_conv;
36363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36364 this_ptr_conv.is_owned = false;
36365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36366 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36367 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
36371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36372 LDKChannelPublicKeys this_ptr_conv;
36373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36374 this_ptr_conv.is_owned = false;
36375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36376 LDKPublicKey val_ref;
36377 CHECK((*env)->GetArrayLength(env, val) == 33);
36378 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36379 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
36382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
36383 LDKChannelPublicKeys this_ptr_conv;
36384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36385 this_ptr_conv.is_owned = false;
36386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36387 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36388 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
36392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36393 LDKChannelPublicKeys this_ptr_conv;
36394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36395 this_ptr_conv.is_owned = false;
36396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36397 LDKPublicKey val_ref;
36398 CHECK((*env)->GetArrayLength(env, val) == 33);
36399 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36400 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
36403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
36404 LDKChannelPublicKeys this_ptr_conv;
36405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36406 this_ptr_conv.is_owned = false;
36407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36408 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36409 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
36413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36414 LDKChannelPublicKeys this_ptr_conv;
36415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36416 this_ptr_conv.is_owned = false;
36417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36418 LDKPublicKey val_ref;
36419 CHECK((*env)->GetArrayLength(env, val) == 33);
36420 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36421 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
36424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
36425 LDKChannelPublicKeys this_ptr_conv;
36426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36427 this_ptr_conv.is_owned = false;
36428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36429 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36430 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
36434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36435 LDKChannelPublicKeys this_ptr_conv;
36436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36437 this_ptr_conv.is_owned = false;
36438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36439 LDKPublicKey val_ref;
36440 CHECK((*env)->GetArrayLength(env, val) == 33);
36441 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36442 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
36445 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) {
36446 LDKPublicKey funding_pubkey_arg_ref;
36447 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
36448 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
36449 LDKPublicKey revocation_basepoint_arg_ref;
36450 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
36451 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
36452 LDKPublicKey payment_point_arg_ref;
36453 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
36454 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
36455 LDKPublicKey delayed_payment_basepoint_arg_ref;
36456 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
36457 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
36458 LDKPublicKey htlc_basepoint_arg_ref;
36459 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
36460 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
36461 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);
36462 uintptr_t ret_ref = 0;
36463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36466 ret_ref = (uintptr_t)ret_var.inner;
36467 if (ret_var.is_owned) {
36473 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
36474 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
36475 uintptr_t ret_ref = 0;
36476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36479 ret_ref = (uintptr_t)ret_var.inner;
36480 if (ret_var.is_owned) {
36485 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36486 LDKChannelPublicKeys arg_conv;
36487 arg_conv.inner = (void*)(arg & (~1));
36488 arg_conv.is_owned = false;
36489 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36490 intptr_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
36494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36495 LDKChannelPublicKeys orig_conv;
36496 orig_conv.inner = (void*)(orig & (~1));
36497 orig_conv.is_owned = false;
36498 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36499 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
36500 uintptr_t ret_ref = 0;
36501 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36502 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36503 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36504 ret_ref = (uintptr_t)ret_var.inner;
36505 if (ret_var.is_owned) {
36511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
36512 LDKChannelPublicKeys obj_conv;
36513 obj_conv.inner = (void*)(obj & (~1));
36514 obj_conv.is_owned = false;
36515 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36516 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
36517 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36518 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36519 CVec_u8Z_free(ret_var);
36523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36524 LDKu8slice ser_ref;
36525 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36526 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36527 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36528 *ret_conv = ChannelPublicKeys_read(ser_ref);
36529 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36530 return (uintptr_t)ret_conv;
36533 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) {
36534 LDKPublicKey per_commitment_point_ref;
36535 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36536 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36537 LDKPublicKey broadcaster_delayed_payment_base_ref;
36538 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
36539 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
36540 LDKPublicKey broadcaster_htlc_base_ref;
36541 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
36542 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
36543 LDKPublicKey countersignatory_revocation_base_ref;
36544 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
36545 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
36546 LDKPublicKey countersignatory_htlc_base_ref;
36547 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
36548 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
36549 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
36550 *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);
36551 return (uintptr_t)ret_conv;
36554 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) {
36555 LDKPublicKey per_commitment_point_ref;
36556 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36557 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36558 LDKChannelPublicKeys broadcaster_keys_conv;
36559 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
36560 broadcaster_keys_conv.is_owned = false;
36561 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
36562 LDKChannelPublicKeys countersignatory_keys_conv;
36563 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
36564 countersignatory_keys_conv.is_owned = false;
36565 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
36566 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
36567 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
36568 return (uintptr_t)ret_conv;
36571 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) {
36572 LDKPublicKey revocation_key_ref;
36573 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
36574 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
36575 LDKPublicKey broadcaster_delayed_payment_key_ref;
36576 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
36577 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
36578 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
36579 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36580 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36581 CVec_u8Z_free(ret_var);
36585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36586 LDKHTLCOutputInCommitment this_obj_conv;
36587 this_obj_conv.inner = (void*)(this_obj & (~1));
36588 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36590 HTLCOutputInCommitment_free(this_obj_conv);
36593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
36594 LDKHTLCOutputInCommitment this_ptr_conv;
36595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36596 this_ptr_conv.is_owned = false;
36597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36598 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
36602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36603 LDKHTLCOutputInCommitment this_ptr_conv;
36604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36605 this_ptr_conv.is_owned = false;
36606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36607 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
36610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36611 LDKHTLCOutputInCommitment this_ptr_conv;
36612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36613 this_ptr_conv.is_owned = false;
36614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36615 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
36619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36620 LDKHTLCOutputInCommitment this_ptr_conv;
36621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36622 this_ptr_conv.is_owned = false;
36623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36624 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
36627 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
36628 LDKHTLCOutputInCommitment this_ptr_conv;
36629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36630 this_ptr_conv.is_owned = false;
36631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36632 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
36636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36637 LDKHTLCOutputInCommitment this_ptr_conv;
36638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36639 this_ptr_conv.is_owned = false;
36640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36641 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
36644 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36645 LDKHTLCOutputInCommitment this_ptr_conv;
36646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36647 this_ptr_conv.is_owned = false;
36648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36649 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36650 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
36654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36655 LDKHTLCOutputInCommitment this_ptr_conv;
36656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36657 this_ptr_conv.is_owned = false;
36658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36659 LDKThirtyTwoBytes val_ref;
36660 CHECK((*env)->GetArrayLength(env, val) == 32);
36661 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36662 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
36665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
36666 LDKHTLCOutputInCommitment this_ptr_conv;
36667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36668 this_ptr_conv.is_owned = false;
36669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36670 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36671 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
36672 uintptr_t ret_ref = (uintptr_t)ret_copy;
36676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36677 LDKHTLCOutputInCommitment this_ptr_conv;
36678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36679 this_ptr_conv.is_owned = false;
36680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36681 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
36682 CHECK_ACCESS(val_ptr);
36683 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36684 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
36685 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
36688 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) {
36689 LDKThirtyTwoBytes payment_hash_arg_ref;
36690 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
36691 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
36692 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
36693 CHECK_ACCESS(transaction_output_index_arg_ptr);
36694 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
36695 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
36696 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
36697 uintptr_t ret_ref = 0;
36698 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36699 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36701 ret_ref = (uintptr_t)ret_var.inner;
36702 if (ret_var.is_owned) {
36708 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
36709 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
36710 uintptr_t ret_ref = 0;
36711 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36712 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36713 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36714 ret_ref = (uintptr_t)ret_var.inner;
36715 if (ret_var.is_owned) {
36720 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36721 LDKHTLCOutputInCommitment arg_conv;
36722 arg_conv.inner = (void*)(arg & (~1));
36723 arg_conv.is_owned = false;
36724 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36725 intptr_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
36729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36730 LDKHTLCOutputInCommitment orig_conv;
36731 orig_conv.inner = (void*)(orig & (~1));
36732 orig_conv.is_owned = false;
36733 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36734 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
36735 uintptr_t ret_ref = 0;
36736 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36737 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36739 ret_ref = (uintptr_t)ret_var.inner;
36740 if (ret_var.is_owned) {
36746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
36747 LDKHTLCOutputInCommitment obj_conv;
36748 obj_conv.inner = (void*)(obj & (~1));
36749 obj_conv.is_owned = false;
36750 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36751 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
36752 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36753 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36754 CVec_u8Z_free(ret_var);
36758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36759 LDKu8slice ser_ref;
36760 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36761 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36762 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36763 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
36764 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36765 return (uintptr_t)ret_conv;
36768 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) {
36769 LDKHTLCOutputInCommitment htlc_conv;
36770 htlc_conv.inner = (void*)(htlc & (~1));
36771 htlc_conv.is_owned = false;
36772 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
36773 LDKTxCreationKeys keys_conv;
36774 keys_conv.inner = (void*)(keys & (~1));
36775 keys_conv.is_owned = false;
36776 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36777 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
36778 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36779 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36780 CVec_u8Z_free(ret_var);
36784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
36785 LDKPublicKey broadcaster_ref;
36786 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
36787 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
36788 LDKPublicKey countersignatory_ref;
36789 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
36790 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
36791 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
36792 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36793 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36794 CVec_u8Z_free(ret_var);
36798 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) {
36799 unsigned char commitment_txid_arr[32];
36800 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
36801 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
36802 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
36803 LDKHTLCOutputInCommitment htlc_conv;
36804 htlc_conv.inner = (void*)(htlc & (~1));
36805 htlc_conv.is_owned = false;
36806 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
36807 LDKPublicKey broadcaster_delayed_payment_key_ref;
36808 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
36809 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
36810 LDKPublicKey revocation_key_ref;
36811 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
36812 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
36813 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);
36814 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36815 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36816 Transaction_free(ret_var);
36820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
36821 LDKPublicKey funding_pubkey_ref;
36822 CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
36823 (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
36824 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
36825 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36826 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36827 CVec_u8Z_free(ret_var);
36831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36832 LDKChannelTransactionParameters this_obj_conv;
36833 this_obj_conv.inner = (void*)(this_obj & (~1));
36834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36836 ChannelTransactionParameters_free(this_obj_conv);
36839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
36840 LDKChannelTransactionParameters this_ptr_conv;
36841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36842 this_ptr_conv.is_owned = false;
36843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36844 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
36845 uintptr_t ret_ref = 0;
36846 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36847 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36849 ret_ref = (uintptr_t)ret_var.inner;
36850 if (ret_var.is_owned) {
36856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36857 LDKChannelTransactionParameters this_ptr_conv;
36858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36859 this_ptr_conv.is_owned = false;
36860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36861 LDKChannelPublicKeys val_conv;
36862 val_conv.inner = (void*)(val & (~1));
36863 val_conv.is_owned = (val & 1) || (val == 0);
36864 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36865 val_conv = ChannelPublicKeys_clone(&val_conv);
36866 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
36869 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
36870 LDKChannelTransactionParameters this_ptr_conv;
36871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36872 this_ptr_conv.is_owned = false;
36873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36874 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
36878 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) {
36879 LDKChannelTransactionParameters this_ptr_conv;
36880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36881 this_ptr_conv.is_owned = false;
36882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36883 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
36886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
36887 LDKChannelTransactionParameters this_ptr_conv;
36888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36889 this_ptr_conv.is_owned = false;
36890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36891 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
36895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36896 LDKChannelTransactionParameters this_ptr_conv;
36897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36898 this_ptr_conv.is_owned = false;
36899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36900 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
36903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
36904 LDKChannelTransactionParameters this_ptr_conv;
36905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36906 this_ptr_conv.is_owned = false;
36907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36908 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
36909 uintptr_t ret_ref = 0;
36910 if ((uintptr_t)ret_var.inner > 4096) {
36911 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36912 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36913 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36914 ret_ref = (uintptr_t)ret_var.inner;
36915 if (ret_var.is_owned) {
36922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36923 LDKChannelTransactionParameters this_ptr_conv;
36924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36925 this_ptr_conv.is_owned = false;
36926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36927 LDKCounterpartyChannelTransactionParameters val_conv;
36928 val_conv.inner = (void*)(val & (~1));
36929 val_conv.is_owned = (val & 1) || (val == 0);
36930 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36931 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
36932 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
36935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
36936 LDKChannelTransactionParameters this_ptr_conv;
36937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36938 this_ptr_conv.is_owned = false;
36939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36940 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
36941 uintptr_t ret_ref = 0;
36942 if ((uintptr_t)ret_var.inner > 4096) {
36943 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36944 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36946 ret_ref = (uintptr_t)ret_var.inner;
36947 if (ret_var.is_owned) {
36954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36955 LDKChannelTransactionParameters this_ptr_conv;
36956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36957 this_ptr_conv.is_owned = false;
36958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36959 LDKOutPoint val_conv;
36960 val_conv.inner = (void*)(val & (~1));
36961 val_conv.is_owned = (val & 1) || (val == 0);
36962 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36963 val_conv = OutPoint_clone(&val_conv);
36964 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
36967 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
36968 LDKChannelTransactionParameters this_ptr_conv;
36969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36970 this_ptr_conv.is_owned = false;
36971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36972 jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
36976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
36977 LDKChannelTransactionParameters this_ptr_conv;
36978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36979 this_ptr_conv.is_owned = false;
36980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36981 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
36982 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
36985 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) {
36986 LDKChannelPublicKeys holder_pubkeys_arg_conv;
36987 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
36988 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
36989 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
36990 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
36991 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
36992 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
36993 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
36994 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
36995 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
36996 LDKOutPoint funding_outpoint_arg_conv;
36997 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
36998 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
36999 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
37000 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
37001 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
37002 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);
37003 uintptr_t ret_ref = 0;
37004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37007 ret_ref = (uintptr_t)ret_var.inner;
37008 if (ret_var.is_owned) {
37014 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
37015 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
37016 uintptr_t ret_ref = 0;
37017 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37018 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37020 ret_ref = (uintptr_t)ret_var.inner;
37021 if (ret_var.is_owned) {
37026 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37027 LDKChannelTransactionParameters arg_conv;
37028 arg_conv.inner = (void*)(arg & (~1));
37029 arg_conv.is_owned = false;
37030 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37031 intptr_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
37035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37036 LDKChannelTransactionParameters orig_conv;
37037 orig_conv.inner = (void*)(orig & (~1));
37038 orig_conv.is_owned = false;
37039 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37040 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
37041 uintptr_t ret_ref = 0;
37042 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37043 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37045 ret_ref = (uintptr_t)ret_var.inner;
37046 if (ret_var.is_owned) {
37052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37053 LDKCounterpartyChannelTransactionParameters this_obj_conv;
37054 this_obj_conv.inner = (void*)(this_obj & (~1));
37055 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37057 CounterpartyChannelTransactionParameters_free(this_obj_conv);
37060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
37061 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37063 this_ptr_conv.is_owned = false;
37064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37065 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
37066 uintptr_t ret_ref = 0;
37067 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37068 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37070 ret_ref = (uintptr_t)ret_var.inner;
37071 if (ret_var.is_owned) {
37077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37078 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37080 this_ptr_conv.is_owned = false;
37081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37082 LDKChannelPublicKeys val_conv;
37083 val_conv.inner = (void*)(val & (~1));
37084 val_conv.is_owned = (val & 1) || (val == 0);
37085 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37086 val_conv = ChannelPublicKeys_clone(&val_conv);
37087 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
37090 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
37091 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37093 this_ptr_conv.is_owned = false;
37094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37095 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
37099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
37100 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37102 this_ptr_conv.is_owned = false;
37103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37104 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
37107 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) {
37108 LDKChannelPublicKeys pubkeys_arg_conv;
37109 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
37110 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
37111 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
37112 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
37113 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
37114 uintptr_t ret_ref = 0;
37115 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37116 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37118 ret_ref = (uintptr_t)ret_var.inner;
37119 if (ret_var.is_owned) {
37125 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
37126 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
37127 uintptr_t ret_ref = 0;
37128 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37129 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37131 ret_ref = (uintptr_t)ret_var.inner;
37132 if (ret_var.is_owned) {
37137 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37138 LDKCounterpartyChannelTransactionParameters arg_conv;
37139 arg_conv.inner = (void*)(arg & (~1));
37140 arg_conv.is_owned = false;
37141 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37142 intptr_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
37146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37147 LDKCounterpartyChannelTransactionParameters orig_conv;
37148 orig_conv.inner = (void*)(orig & (~1));
37149 orig_conv.is_owned = false;
37150 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37151 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
37152 uintptr_t ret_ref = 0;
37153 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37154 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37156 ret_ref = (uintptr_t)ret_var.inner;
37157 if (ret_var.is_owned) {
37163 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
37164 LDKChannelTransactionParameters this_arg_conv;
37165 this_arg_conv.inner = (void*)(this_arg & (~1));
37166 this_arg_conv.is_owned = false;
37167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37168 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
37172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
37173 LDKChannelTransactionParameters this_arg_conv;
37174 this_arg_conv.inner = (void*)(this_arg & (~1));
37175 this_arg_conv.is_owned = false;
37176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37177 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
37178 uintptr_t ret_ref = 0;
37179 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37180 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37181 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37182 ret_ref = (uintptr_t)ret_var.inner;
37183 if (ret_var.is_owned) {
37189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
37190 LDKChannelTransactionParameters this_arg_conv;
37191 this_arg_conv.inner = (void*)(this_arg & (~1));
37192 this_arg_conv.is_owned = false;
37193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37194 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
37195 uintptr_t ret_ref = 0;
37196 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37197 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37199 ret_ref = (uintptr_t)ret_var.inner;
37200 if (ret_var.is_owned) {
37206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
37207 LDKCounterpartyChannelTransactionParameters obj_conv;
37208 obj_conv.inner = (void*)(obj & (~1));
37209 obj_conv.is_owned = false;
37210 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37211 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
37212 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37213 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37214 CVec_u8Z_free(ret_var);
37218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37219 LDKu8slice ser_ref;
37220 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37221 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37222 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
37223 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
37224 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37225 return (uintptr_t)ret_conv;
37228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
37229 LDKChannelTransactionParameters obj_conv;
37230 obj_conv.inner = (void*)(obj & (~1));
37231 obj_conv.is_owned = false;
37232 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37233 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
37234 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37235 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37236 CVec_u8Z_free(ret_var);
37240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37241 LDKu8slice ser_ref;
37242 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37243 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37244 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
37245 *ret_conv = ChannelTransactionParameters_read(ser_ref);
37246 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37247 return (uintptr_t)ret_conv;
37250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37251 LDKDirectedChannelTransactionParameters this_obj_conv;
37252 this_obj_conv.inner = (void*)(this_obj & (~1));
37253 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37255 DirectedChannelTransactionParameters_free(this_obj_conv);
37258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
37259 LDKDirectedChannelTransactionParameters this_arg_conv;
37260 this_arg_conv.inner = (void*)(this_arg & (~1));
37261 this_arg_conv.is_owned = false;
37262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37263 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
37264 uintptr_t ret_ref = 0;
37265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37268 ret_ref = (uintptr_t)ret_var.inner;
37269 if (ret_var.is_owned) {
37275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
37276 LDKDirectedChannelTransactionParameters this_arg_conv;
37277 this_arg_conv.inner = (void*)(this_arg & (~1));
37278 this_arg_conv.is_owned = false;
37279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37280 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
37281 uintptr_t ret_ref = 0;
37282 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37283 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37284 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37285 ret_ref = (uintptr_t)ret_var.inner;
37286 if (ret_var.is_owned) {
37292 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
37293 LDKDirectedChannelTransactionParameters this_arg_conv;
37294 this_arg_conv.inner = (void*)(this_arg & (~1));
37295 this_arg_conv.is_owned = false;
37296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37297 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
37301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
37302 LDKDirectedChannelTransactionParameters this_arg_conv;
37303 this_arg_conv.inner = (void*)(this_arg & (~1));
37304 this_arg_conv.is_owned = false;
37305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37306 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
37310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
37311 LDKDirectedChannelTransactionParameters this_arg_conv;
37312 this_arg_conv.inner = (void*)(this_arg & (~1));
37313 this_arg_conv.is_owned = false;
37314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37315 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
37316 uintptr_t ret_ref = 0;
37317 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37318 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37319 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37320 ret_ref = (uintptr_t)ret_var.inner;
37321 if (ret_var.is_owned) {
37327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
37328 LDKDirectedChannelTransactionParameters this_arg_conv;
37329 this_arg_conv.inner = (void*)(this_arg & (~1));
37330 this_arg_conv.is_owned = false;
37331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37332 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
37336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37337 LDKHolderCommitmentTransaction this_obj_conv;
37338 this_obj_conv.inner = (void*)(this_obj & (~1));
37339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37341 HolderCommitmentTransaction_free(this_obj_conv);
37344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
37345 LDKHolderCommitmentTransaction this_ptr_conv;
37346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37347 this_ptr_conv.is_owned = false;
37348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37349 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
37350 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
37354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37355 LDKHolderCommitmentTransaction this_ptr_conv;
37356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37357 this_ptr_conv.is_owned = false;
37358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37359 LDKSignature val_ref;
37360 CHECK((*env)->GetArrayLength(env, val) == 64);
37361 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
37362 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
37365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
37366 LDKHolderCommitmentTransaction this_ptr_conv;
37367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37368 this_ptr_conv.is_owned = false;
37369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37370 LDKCVec_SignatureZ val_constr;
37371 val_constr.datalen = (*env)->GetArrayLength(env, val);
37372 if (val_constr.datalen > 0)
37373 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
37375 val_constr.data = NULL;
37376 for (size_t i = 0; i < val_constr.datalen; i++) {
37377 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
37378 LDKSignature val_conv_8_ref;
37379 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
37380 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
37381 val_constr.data[i] = val_conv_8_ref;
37383 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
37386 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
37387 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
37388 uintptr_t ret_ref = 0;
37389 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37390 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37392 ret_ref = (uintptr_t)ret_var.inner;
37393 if (ret_var.is_owned) {
37398 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37399 LDKHolderCommitmentTransaction arg_conv;
37400 arg_conv.inner = (void*)(arg & (~1));
37401 arg_conv.is_owned = false;
37402 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37403 intptr_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
37407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37408 LDKHolderCommitmentTransaction orig_conv;
37409 orig_conv.inner = (void*)(orig & (~1));
37410 orig_conv.is_owned = false;
37411 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37412 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
37413 uintptr_t ret_ref = 0;
37414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37417 ret_ref = (uintptr_t)ret_var.inner;
37418 if (ret_var.is_owned) {
37424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
37425 LDKHolderCommitmentTransaction obj_conv;
37426 obj_conv.inner = (void*)(obj & (~1));
37427 obj_conv.is_owned = false;
37428 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37429 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
37430 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37431 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37432 CVec_u8Z_free(ret_var);
37436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37437 LDKu8slice ser_ref;
37438 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37439 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37440 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
37441 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
37442 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37443 return (uintptr_t)ret_conv;
37446 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) {
37447 LDKCommitmentTransaction commitment_tx_conv;
37448 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
37449 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
37450 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
37451 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
37452 LDKSignature counterparty_sig_ref;
37453 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
37454 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
37455 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
37456 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
37457 if (counterparty_htlc_sigs_constr.datalen > 0)
37458 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
37460 counterparty_htlc_sigs_constr.data = NULL;
37461 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
37462 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
37463 LDKSignature counterparty_htlc_sigs_conv_8_ref;
37464 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
37465 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
37466 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
37468 LDKPublicKey holder_funding_key_ref;
37469 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
37470 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
37471 LDKPublicKey counterparty_funding_key_ref;
37472 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
37473 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
37474 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
37475 uintptr_t ret_ref = 0;
37476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37479 ret_ref = (uintptr_t)ret_var.inner;
37480 if (ret_var.is_owned) {
37486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37487 LDKBuiltCommitmentTransaction this_obj_conv;
37488 this_obj_conv.inner = (void*)(this_obj & (~1));
37489 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37491 BuiltCommitmentTransaction_free(this_obj_conv);
37494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
37495 LDKBuiltCommitmentTransaction this_ptr_conv;
37496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37497 this_ptr_conv.is_owned = false;
37498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37499 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
37500 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37501 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37502 Transaction_free(ret_var);
37506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37507 LDKBuiltCommitmentTransaction this_ptr_conv;
37508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37509 this_ptr_conv.is_owned = false;
37510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37511 LDKTransaction val_ref;
37512 val_ref.datalen = (*env)->GetArrayLength(env, val);
37513 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
37514 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
37515 val_ref.data_is_owned = true;
37516 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
37519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
37520 LDKBuiltCommitmentTransaction this_ptr_conv;
37521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37522 this_ptr_conv.is_owned = false;
37523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37524 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37525 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
37529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37530 LDKBuiltCommitmentTransaction this_ptr_conv;
37531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37532 this_ptr_conv.is_owned = false;
37533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37534 LDKThirtyTwoBytes val_ref;
37535 CHECK((*env)->GetArrayLength(env, val) == 32);
37536 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37537 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
37540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
37541 LDKTransaction transaction_arg_ref;
37542 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
37543 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
37544 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
37545 transaction_arg_ref.data_is_owned = true;
37546 LDKThirtyTwoBytes txid_arg_ref;
37547 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
37548 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
37549 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
37550 uintptr_t ret_ref = 0;
37551 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37552 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37554 ret_ref = (uintptr_t)ret_var.inner;
37555 if (ret_var.is_owned) {
37561 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
37562 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
37563 uintptr_t ret_ref = 0;
37564 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37565 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37567 ret_ref = (uintptr_t)ret_var.inner;
37568 if (ret_var.is_owned) {
37573 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37574 LDKBuiltCommitmentTransaction arg_conv;
37575 arg_conv.inner = (void*)(arg & (~1));
37576 arg_conv.is_owned = false;
37577 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37578 intptr_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
37582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37583 LDKBuiltCommitmentTransaction orig_conv;
37584 orig_conv.inner = (void*)(orig & (~1));
37585 orig_conv.is_owned = false;
37586 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37587 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
37588 uintptr_t ret_ref = 0;
37589 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37590 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37592 ret_ref = (uintptr_t)ret_var.inner;
37593 if (ret_var.is_owned) {
37599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
37600 LDKBuiltCommitmentTransaction obj_conv;
37601 obj_conv.inner = (void*)(obj & (~1));
37602 obj_conv.is_owned = false;
37603 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37604 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
37605 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37606 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37607 CVec_u8Z_free(ret_var);
37611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37612 LDKu8slice ser_ref;
37613 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37614 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37615 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
37616 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
37617 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37618 return (uintptr_t)ret_conv;
37621 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) {
37622 LDKBuiltCommitmentTransaction this_arg_conv;
37623 this_arg_conv.inner = (void*)(this_arg & (~1));
37624 this_arg_conv.is_owned = false;
37625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37626 LDKu8slice funding_redeemscript_ref;
37627 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
37628 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
37629 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37630 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
37631 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
37635 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) {
37636 LDKBuiltCommitmentTransaction this_arg_conv;
37637 this_arg_conv.inner = (void*)(this_arg & (~1));
37638 this_arg_conv.is_owned = false;
37639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37640 unsigned char funding_key_arr[32];
37641 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
37642 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
37643 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
37644 LDKu8slice funding_redeemscript_ref;
37645 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
37646 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
37647 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
37648 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
37649 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
37653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37654 LDKClosingTransaction this_obj_conv;
37655 this_obj_conv.inner = (void*)(this_obj & (~1));
37656 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37658 ClosingTransaction_free(this_obj_conv);
37661 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
37662 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
37663 uintptr_t ret_ref = 0;
37664 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37665 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37667 ret_ref = (uintptr_t)ret_var.inner;
37668 if (ret_var.is_owned) {
37673 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37674 LDKClosingTransaction arg_conv;
37675 arg_conv.inner = (void*)(arg & (~1));
37676 arg_conv.is_owned = false;
37677 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37678 intptr_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
37682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37683 LDKClosingTransaction orig_conv;
37684 orig_conv.inner = (void*)(orig & (~1));
37685 orig_conv.is_owned = false;
37686 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37687 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
37688 uintptr_t ret_ref = 0;
37689 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37690 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37691 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37692 ret_ref = (uintptr_t)ret_var.inner;
37693 if (ret_var.is_owned) {
37699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
37700 LDKClosingTransaction o_conv;
37701 o_conv.inner = (void*)(o & (~1));
37702 o_conv.is_owned = false;
37703 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37704 int64_t ret_val = ClosingTransaction_hash(&o_conv);
37708 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) {
37709 LDKCVec_u8Z to_holder_script_ref;
37710 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
37711 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37712 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
37713 LDKCVec_u8Z to_counterparty_script_ref;
37714 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
37715 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37716 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
37717 LDKOutPoint funding_outpoint_conv;
37718 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
37719 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
37720 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37721 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37722 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
37723 uintptr_t ret_ref = 0;
37724 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37725 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37726 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37727 ret_ref = (uintptr_t)ret_var.inner;
37728 if (ret_var.is_owned) {
37734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
37735 LDKClosingTransaction this_arg_conv;
37736 this_arg_conv.inner = (void*)(this_arg & (~1));
37737 this_arg_conv.is_owned = false;
37738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37739 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
37740 uintptr_t ret_ref = 0;
37741 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37742 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37743 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37744 ret_ref = (uintptr_t)ret_var.inner;
37745 if (ret_var.is_owned) {
37751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
37752 LDKClosingTransaction this_arg_conv;
37753 this_arg_conv.inner = (void*)(this_arg & (~1));
37754 this_arg_conv.is_owned = false;
37755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37756 LDKOutPoint funding_outpoint_conv;
37757 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
37758 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
37759 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37760 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37761 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
37762 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
37763 return (uintptr_t)ret_conv;
37766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
37767 LDKClosingTransaction this_arg_conv;
37768 this_arg_conv.inner = (void*)(this_arg & (~1));
37769 this_arg_conv.is_owned = false;
37770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37771 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
37775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
37776 LDKClosingTransaction this_arg_conv;
37777 this_arg_conv.inner = (void*)(this_arg & (~1));
37778 this_arg_conv.is_owned = false;
37779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37780 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
37784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
37785 LDKClosingTransaction this_arg_conv;
37786 this_arg_conv.inner = (void*)(this_arg & (~1));
37787 this_arg_conv.is_owned = false;
37788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37789 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
37790 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37791 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
37796 LDKClosingTransaction this_arg_conv;
37797 this_arg_conv.inner = (void*)(this_arg & (~1));
37798 this_arg_conv.is_owned = false;
37799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37800 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
37801 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37802 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37807 LDKTrustedClosingTransaction this_obj_conv;
37808 this_obj_conv.inner = (void*)(this_obj & (~1));
37809 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37811 TrustedClosingTransaction_free(this_obj_conv);
37814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
37815 LDKTrustedClosingTransaction this_arg_conv;
37816 this_arg_conv.inner = (void*)(this_arg & (~1));
37817 this_arg_conv.is_owned = false;
37818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37819 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
37820 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37821 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37822 Transaction_free(ret_var);
37826 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) {
37827 LDKTrustedClosingTransaction this_arg_conv;
37828 this_arg_conv.inner = (void*)(this_arg & (~1));
37829 this_arg_conv.is_owned = false;
37830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37831 LDKu8slice funding_redeemscript_ref;
37832 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
37833 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
37834 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37835 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
37836 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
37840 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) {
37841 LDKTrustedClosingTransaction this_arg_conv;
37842 this_arg_conv.inner = (void*)(this_arg & (~1));
37843 this_arg_conv.is_owned = false;
37844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37845 unsigned char funding_key_arr[32];
37846 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
37847 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
37848 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
37849 LDKu8slice funding_redeemscript_ref;
37850 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
37851 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
37852 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
37853 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
37854 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
37858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37859 LDKCommitmentTransaction this_obj_conv;
37860 this_obj_conv.inner = (void*)(this_obj & (~1));
37861 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37863 CommitmentTransaction_free(this_obj_conv);
37866 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
37867 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
37868 uintptr_t ret_ref = 0;
37869 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37870 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37871 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37872 ret_ref = (uintptr_t)ret_var.inner;
37873 if (ret_var.is_owned) {
37878 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37879 LDKCommitmentTransaction arg_conv;
37880 arg_conv.inner = (void*)(arg & (~1));
37881 arg_conv.is_owned = false;
37882 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37883 intptr_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
37887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37888 LDKCommitmentTransaction orig_conv;
37889 orig_conv.inner = (void*)(orig & (~1));
37890 orig_conv.is_owned = false;
37891 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37892 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
37893 uintptr_t ret_ref = 0;
37894 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37895 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37897 ret_ref = (uintptr_t)ret_var.inner;
37898 if (ret_var.is_owned) {
37904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
37905 LDKCommitmentTransaction obj_conv;
37906 obj_conv.inner = (void*)(obj & (~1));
37907 obj_conv.is_owned = false;
37908 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37909 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
37910 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37911 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37912 CVec_u8Z_free(ret_var);
37916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37917 LDKu8slice ser_ref;
37918 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37919 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37920 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
37921 *ret_conv = CommitmentTransaction_read(ser_ref);
37922 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37923 return (uintptr_t)ret_conv;
37926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
37927 LDKCommitmentTransaction this_arg_conv;
37928 this_arg_conv.inner = (void*)(this_arg & (~1));
37929 this_arg_conv.is_owned = false;
37930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37931 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
37935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
37936 LDKCommitmentTransaction this_arg_conv;
37937 this_arg_conv.inner = (void*)(this_arg & (~1));
37938 this_arg_conv.is_owned = false;
37939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37940 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
37944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
37945 LDKCommitmentTransaction this_arg_conv;
37946 this_arg_conv.inner = (void*)(this_arg & (~1));
37947 this_arg_conv.is_owned = false;
37948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37949 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
37953 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
37954 LDKCommitmentTransaction this_arg_conv;
37955 this_arg_conv.inner = (void*)(this_arg & (~1));
37956 this_arg_conv.is_owned = false;
37957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37958 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
37962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
37963 LDKCommitmentTransaction this_arg_conv;
37964 this_arg_conv.inner = (void*)(this_arg & (~1));
37965 this_arg_conv.is_owned = false;
37966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37967 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
37968 uintptr_t ret_ref = 0;
37969 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37970 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37971 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37972 ret_ref = (uintptr_t)ret_var.inner;
37973 if (ret_var.is_owned) {
37979 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) {
37980 LDKCommitmentTransaction this_arg_conv;
37981 this_arg_conv.inner = (void*)(this_arg & (~1));
37982 this_arg_conv.is_owned = false;
37983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37984 LDKDirectedChannelTransactionParameters channel_parameters_conv;
37985 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
37986 channel_parameters_conv.is_owned = false;
37987 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
37988 LDKChannelPublicKeys broadcaster_keys_conv;
37989 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
37990 broadcaster_keys_conv.is_owned = false;
37991 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37992 LDKChannelPublicKeys countersignatory_keys_conv;
37993 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
37994 countersignatory_keys_conv.is_owned = false;
37995 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37996 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
37997 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
37998 return (uintptr_t)ret_conv;
38001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38002 LDKTrustedCommitmentTransaction this_obj_conv;
38003 this_obj_conv.inner = (void*)(this_obj & (~1));
38004 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38006 TrustedCommitmentTransaction_free(this_obj_conv);
38009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
38010 LDKTrustedCommitmentTransaction this_arg_conv;
38011 this_arg_conv.inner = (void*)(this_arg & (~1));
38012 this_arg_conv.is_owned = false;
38013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38014 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38015 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
38019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
38020 LDKTrustedCommitmentTransaction this_arg_conv;
38021 this_arg_conv.inner = (void*)(this_arg & (~1));
38022 this_arg_conv.is_owned = false;
38023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38024 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
38025 uintptr_t ret_ref = 0;
38026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38029 ret_ref = (uintptr_t)ret_var.inner;
38030 if (ret_var.is_owned) {
38036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
38037 LDKTrustedCommitmentTransaction this_arg_conv;
38038 this_arg_conv.inner = (void*)(this_arg & (~1));
38039 this_arg_conv.is_owned = false;
38040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38041 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
38042 uintptr_t ret_ref = 0;
38043 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38044 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38046 ret_ref = (uintptr_t)ret_var.inner;
38047 if (ret_var.is_owned) {
38053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
38054 LDKTrustedCommitmentTransaction this_arg_conv;
38055 this_arg_conv.inner = (void*)(this_arg & (~1));
38056 this_arg_conv.is_owned = false;
38057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38058 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
38062 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) {
38063 LDKTrustedCommitmentTransaction this_arg_conv;
38064 this_arg_conv.inner = (void*)(this_arg & (~1));
38065 this_arg_conv.is_owned = false;
38066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38067 unsigned char htlc_base_key_arr[32];
38068 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
38069 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
38070 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
38071 LDKDirectedChannelTransactionParameters channel_parameters_conv;
38072 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
38073 channel_parameters_conv.is_owned = false;
38074 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38075 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
38076 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
38077 return (uintptr_t)ret_conv;
38080 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) {
38081 LDKPublicKey broadcaster_payment_basepoint_ref;
38082 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
38083 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
38084 LDKPublicKey countersignatory_payment_basepoint_ref;
38085 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
38086 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
38087 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
38091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38092 LDKInitFeatures a_conv;
38093 a_conv.inner = (void*)(a & (~1));
38094 a_conv.is_owned = false;
38095 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38096 LDKInitFeatures b_conv;
38097 b_conv.inner = (void*)(b & (~1));
38098 b_conv.is_owned = false;
38099 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38100 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
38104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38105 LDKNodeFeatures a_conv;
38106 a_conv.inner = (void*)(a & (~1));
38107 a_conv.is_owned = false;
38108 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38109 LDKNodeFeatures b_conv;
38110 b_conv.inner = (void*)(b & (~1));
38111 b_conv.is_owned = false;
38112 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38113 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
38117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38118 LDKChannelFeatures a_conv;
38119 a_conv.inner = (void*)(a & (~1));
38120 a_conv.is_owned = false;
38121 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38122 LDKChannelFeatures b_conv;
38123 b_conv.inner = (void*)(b & (~1));
38124 b_conv.is_owned = false;
38125 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38126 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
38130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38131 LDKInvoiceFeatures a_conv;
38132 a_conv.inner = (void*)(a & (~1));
38133 a_conv.is_owned = false;
38134 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38135 LDKInvoiceFeatures b_conv;
38136 b_conv.inner = (void*)(b & (~1));
38137 b_conv.is_owned = false;
38138 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38139 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
38143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38144 LDKChannelTypeFeatures a_conv;
38145 a_conv.inner = (void*)(a & (~1));
38146 a_conv.is_owned = false;
38147 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38148 LDKChannelTypeFeatures b_conv;
38149 b_conv.inner = (void*)(b & (~1));
38150 b_conv.is_owned = false;
38151 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38152 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
38156 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
38157 LDKInitFeatures ret_var = InitFeatures_clone(arg);
38158 uintptr_t ret_ref = 0;
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) {
38168 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38169 LDKInitFeatures arg_conv;
38170 arg_conv.inner = (void*)(arg & (~1));
38171 arg_conv.is_owned = false;
38172 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38173 intptr_t ret_val = InitFeatures_clone_ptr(&arg_conv);
38177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38178 LDKInitFeatures orig_conv;
38179 orig_conv.inner = (void*)(orig & (~1));
38180 orig_conv.is_owned = false;
38181 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38182 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
38183 uintptr_t ret_ref = 0;
38184 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38185 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38186 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38187 ret_ref = (uintptr_t)ret_var.inner;
38188 if (ret_var.is_owned) {
38194 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
38195 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
38196 uintptr_t ret_ref = 0;
38197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38200 ret_ref = (uintptr_t)ret_var.inner;
38201 if (ret_var.is_owned) {
38206 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38207 LDKNodeFeatures arg_conv;
38208 arg_conv.inner = (void*)(arg & (~1));
38209 arg_conv.is_owned = false;
38210 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38211 intptr_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
38215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38216 LDKNodeFeatures orig_conv;
38217 orig_conv.inner = (void*)(orig & (~1));
38218 orig_conv.is_owned = false;
38219 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38220 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
38221 uintptr_t ret_ref = 0;
38222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38225 ret_ref = (uintptr_t)ret_var.inner;
38226 if (ret_var.is_owned) {
38232 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
38233 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
38234 uintptr_t ret_ref = 0;
38235 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38236 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38238 ret_ref = (uintptr_t)ret_var.inner;
38239 if (ret_var.is_owned) {
38244 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38245 LDKChannelFeatures arg_conv;
38246 arg_conv.inner = (void*)(arg & (~1));
38247 arg_conv.is_owned = false;
38248 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38249 intptr_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
38253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38254 LDKChannelFeatures orig_conv;
38255 orig_conv.inner = (void*)(orig & (~1));
38256 orig_conv.is_owned = false;
38257 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38258 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
38259 uintptr_t ret_ref = 0;
38260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38263 ret_ref = (uintptr_t)ret_var.inner;
38264 if (ret_var.is_owned) {
38270 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
38271 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
38272 uintptr_t ret_ref = 0;
38273 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38274 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38276 ret_ref = (uintptr_t)ret_var.inner;
38277 if (ret_var.is_owned) {
38282 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38283 LDKInvoiceFeatures arg_conv;
38284 arg_conv.inner = (void*)(arg & (~1));
38285 arg_conv.is_owned = false;
38286 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38287 intptr_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
38291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38292 LDKInvoiceFeatures orig_conv;
38293 orig_conv.inner = (void*)(orig & (~1));
38294 orig_conv.is_owned = false;
38295 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38296 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
38297 uintptr_t ret_ref = 0;
38298 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38299 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38300 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38301 ret_ref = (uintptr_t)ret_var.inner;
38302 if (ret_var.is_owned) {
38308 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
38309 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
38310 uintptr_t ret_ref = 0;
38311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38314 ret_ref = (uintptr_t)ret_var.inner;
38315 if (ret_var.is_owned) {
38320 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38321 LDKChannelTypeFeatures arg_conv;
38322 arg_conv.inner = (void*)(arg & (~1));
38323 arg_conv.is_owned = false;
38324 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38325 intptr_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
38329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38330 LDKChannelTypeFeatures orig_conv;
38331 orig_conv.inner = (void*)(orig & (~1));
38332 orig_conv.is_owned = false;
38333 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38334 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
38335 uintptr_t ret_ref = 0;
38336 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38337 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38339 ret_ref = (uintptr_t)ret_var.inner;
38340 if (ret_var.is_owned) {
38346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38347 LDKInitFeatures this_obj_conv;
38348 this_obj_conv.inner = (void*)(this_obj & (~1));
38349 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38351 InitFeatures_free(this_obj_conv);
38354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38355 LDKNodeFeatures this_obj_conv;
38356 this_obj_conv.inner = (void*)(this_obj & (~1));
38357 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38359 NodeFeatures_free(this_obj_conv);
38362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38363 LDKChannelFeatures this_obj_conv;
38364 this_obj_conv.inner = (void*)(this_obj & (~1));
38365 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38367 ChannelFeatures_free(this_obj_conv);
38370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38371 LDKInvoiceFeatures this_obj_conv;
38372 this_obj_conv.inner = (void*)(this_obj & (~1));
38373 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38375 InvoiceFeatures_free(this_obj_conv);
38378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38379 LDKChannelTypeFeatures this_obj_conv;
38380 this_obj_conv.inner = (void*)(this_obj & (~1));
38381 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38383 ChannelTypeFeatures_free(this_obj_conv);
38386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
38387 LDKInitFeatures ret_var = InitFeatures_empty();
38388 uintptr_t ret_ref = 0;
38389 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38390 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38392 ret_ref = (uintptr_t)ret_var.inner;
38393 if (ret_var.is_owned) {
38399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
38400 LDKInitFeatures ret_var = InitFeatures_known();
38401 uintptr_t ret_ref = 0;
38402 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38403 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38405 ret_ref = (uintptr_t)ret_var.inner;
38406 if (ret_var.is_owned) {
38412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
38413 LDKInitFeatures this_arg_conv;
38414 this_arg_conv.inner = (void*)(this_arg & (~1));
38415 this_arg_conv.is_owned = false;
38416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38417 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
38421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
38422 LDKNodeFeatures ret_var = NodeFeatures_empty();
38423 uintptr_t ret_ref = 0;
38424 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38425 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38426 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38427 ret_ref = (uintptr_t)ret_var.inner;
38428 if (ret_var.is_owned) {
38434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
38435 LDKNodeFeatures ret_var = NodeFeatures_known();
38436 uintptr_t ret_ref = 0;
38437 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38438 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38439 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38440 ret_ref = (uintptr_t)ret_var.inner;
38441 if (ret_var.is_owned) {
38447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
38448 LDKNodeFeatures this_arg_conv;
38449 this_arg_conv.inner = (void*)(this_arg & (~1));
38450 this_arg_conv.is_owned = false;
38451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38452 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
38456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
38457 LDKChannelFeatures ret_var = ChannelFeatures_empty();
38458 uintptr_t ret_ref = 0;
38459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38462 ret_ref = (uintptr_t)ret_var.inner;
38463 if (ret_var.is_owned) {
38469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
38470 LDKChannelFeatures ret_var = ChannelFeatures_known();
38471 uintptr_t ret_ref = 0;
38472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38475 ret_ref = (uintptr_t)ret_var.inner;
38476 if (ret_var.is_owned) {
38482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
38483 LDKChannelFeatures this_arg_conv;
38484 this_arg_conv.inner = (void*)(this_arg & (~1));
38485 this_arg_conv.is_owned = false;
38486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38487 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
38491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
38492 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
38493 uintptr_t ret_ref = 0;
38494 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38495 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38496 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38497 ret_ref = (uintptr_t)ret_var.inner;
38498 if (ret_var.is_owned) {
38504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
38505 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
38506 uintptr_t ret_ref = 0;
38507 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38508 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38510 ret_ref = (uintptr_t)ret_var.inner;
38511 if (ret_var.is_owned) {
38517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
38518 LDKInvoiceFeatures this_arg_conv;
38519 this_arg_conv.inner = (void*)(this_arg & (~1));
38520 this_arg_conv.is_owned = false;
38521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38522 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
38526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
38527 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
38528 uintptr_t ret_ref = 0;
38529 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38530 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38532 ret_ref = (uintptr_t)ret_var.inner;
38533 if (ret_var.is_owned) {
38539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
38540 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
38541 uintptr_t ret_ref = 0;
38542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38545 ret_ref = (uintptr_t)ret_var.inner;
38546 if (ret_var.is_owned) {
38552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
38553 LDKChannelTypeFeatures this_arg_conv;
38554 this_arg_conv.inner = (void*)(this_arg & (~1));
38555 this_arg_conv.is_owned = false;
38556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38557 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
38561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
38562 LDKInitFeatures obj_conv;
38563 obj_conv.inner = (void*)(obj & (~1));
38564 obj_conv.is_owned = false;
38565 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38566 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
38567 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38568 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38569 CVec_u8Z_free(ret_var);
38573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38574 LDKu8slice ser_ref;
38575 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38576 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38577 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
38578 *ret_conv = InitFeatures_read(ser_ref);
38579 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38580 return (uintptr_t)ret_conv;
38583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
38584 LDKChannelFeatures obj_conv;
38585 obj_conv.inner = (void*)(obj & (~1));
38586 obj_conv.is_owned = false;
38587 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38588 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
38589 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38590 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38591 CVec_u8Z_free(ret_var);
38595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38596 LDKu8slice ser_ref;
38597 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38598 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38599 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
38600 *ret_conv = ChannelFeatures_read(ser_ref);
38601 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38602 return (uintptr_t)ret_conv;
38605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
38606 LDKNodeFeatures obj_conv;
38607 obj_conv.inner = (void*)(obj & (~1));
38608 obj_conv.is_owned = false;
38609 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38610 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
38611 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38612 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38613 CVec_u8Z_free(ret_var);
38617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38618 LDKu8slice ser_ref;
38619 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38620 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38621 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
38622 *ret_conv = NodeFeatures_read(ser_ref);
38623 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38624 return (uintptr_t)ret_conv;
38627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
38628 LDKInvoiceFeatures obj_conv;
38629 obj_conv.inner = (void*)(obj & (~1));
38630 obj_conv.is_owned = false;
38631 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38632 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
38633 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38634 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38635 CVec_u8Z_free(ret_var);
38639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38640 LDKu8slice ser_ref;
38641 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38642 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38643 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
38644 *ret_conv = InvoiceFeatures_read(ser_ref);
38645 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38646 return (uintptr_t)ret_conv;
38649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
38650 LDKChannelTypeFeatures obj_conv;
38651 obj_conv.inner = (void*)(obj & (~1));
38652 obj_conv.is_owned = false;
38653 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38654 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
38655 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38656 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38657 CVec_u8Z_free(ret_var);
38661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38662 LDKu8slice ser_ref;
38663 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38664 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38665 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
38666 *ret_conv = ChannelTypeFeatures_read(ser_ref);
38667 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38668 return (uintptr_t)ret_conv;
38671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38672 LDKShutdownScript this_obj_conv;
38673 this_obj_conv.inner = (void*)(this_obj & (~1));
38674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38676 ShutdownScript_free(this_obj_conv);
38679 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
38680 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
38681 uintptr_t ret_ref = 0;
38682 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38683 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38685 ret_ref = (uintptr_t)ret_var.inner;
38686 if (ret_var.is_owned) {
38691 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38692 LDKShutdownScript arg_conv;
38693 arg_conv.inner = (void*)(arg & (~1));
38694 arg_conv.is_owned = false;
38695 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38696 intptr_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
38700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38701 LDKShutdownScript orig_conv;
38702 orig_conv.inner = (void*)(orig & (~1));
38703 orig_conv.is_owned = false;
38704 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38705 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
38706 uintptr_t ret_ref = 0;
38707 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38708 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38710 ret_ref = (uintptr_t)ret_var.inner;
38711 if (ret_var.is_owned) {
38717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38718 LDKInvalidShutdownScript this_obj_conv;
38719 this_obj_conv.inner = (void*)(this_obj & (~1));
38720 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38722 InvalidShutdownScript_free(this_obj_conv);
38725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
38726 LDKInvalidShutdownScript this_ptr_conv;
38727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38728 this_ptr_conv.is_owned = false;
38729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38730 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
38731 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38732 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38737 LDKInvalidShutdownScript this_ptr_conv;
38738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38739 this_ptr_conv.is_owned = false;
38740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38741 LDKCVec_u8Z val_ref;
38742 val_ref.datalen = (*env)->GetArrayLength(env, val);
38743 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38744 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
38745 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
38748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
38749 LDKCVec_u8Z script_arg_ref;
38750 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
38751 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38752 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
38753 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
38754 uintptr_t ret_ref = 0;
38755 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38756 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38758 ret_ref = (uintptr_t)ret_var.inner;
38759 if (ret_var.is_owned) {
38765 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
38766 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
38767 uintptr_t ret_ref = 0;
38768 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38769 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38771 ret_ref = (uintptr_t)ret_var.inner;
38772 if (ret_var.is_owned) {
38777 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38778 LDKInvalidShutdownScript arg_conv;
38779 arg_conv.inner = (void*)(arg & (~1));
38780 arg_conv.is_owned = false;
38781 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38782 intptr_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
38786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38787 LDKInvalidShutdownScript orig_conv;
38788 orig_conv.inner = (void*)(orig & (~1));
38789 orig_conv.is_owned = false;
38790 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38791 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
38792 uintptr_t ret_ref = 0;
38793 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38794 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38796 ret_ref = (uintptr_t)ret_var.inner;
38797 if (ret_var.is_owned) {
38803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
38804 LDKShutdownScript obj_conv;
38805 obj_conv.inner = (void*)(obj & (~1));
38806 obj_conv.is_owned = false;
38807 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38808 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
38809 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38810 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38811 CVec_u8Z_free(ret_var);
38815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38816 LDKu8slice ser_ref;
38817 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38818 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38819 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
38820 *ret_conv = ShutdownScript_read(ser_ref);
38821 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38822 return (uintptr_t)ret_conv;
38825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
38826 unsigned char pubkey_hash_arr[20];
38827 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
38828 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
38829 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
38830 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
38843 unsigned char script_hash_arr[32];
38844 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
38845 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
38846 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
38847 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
38848 uintptr_t ret_ref = 0;
38849 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38850 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38851 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38852 ret_ref = (uintptr_t)ret_var.inner;
38853 if (ret_var.is_owned) {
38859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
38860 LDKu8slice program_ref;
38861 program_ref.datalen = (*env)->GetArrayLength(env, program);
38862 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
38863 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
38864 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
38865 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
38866 return (uintptr_t)ret_conv;
38869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
38870 LDKShutdownScript this_arg_conv;
38871 this_arg_conv.inner = (void*)(this_arg & (~1));
38872 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
38873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38874 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
38875 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
38876 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38877 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38878 CVec_u8Z_free(ret_var);
38882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
38883 LDKShutdownScript this_arg_conv;
38884 this_arg_conv.inner = (void*)(this_arg & (~1));
38885 this_arg_conv.is_owned = false;
38886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38887 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38888 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
38892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
38893 LDKShutdownScript this_arg_conv;
38894 this_arg_conv.inner = (void*)(this_arg & (~1));
38895 this_arg_conv.is_owned = false;
38896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38897 LDKInitFeatures features_conv;
38898 features_conv.inner = (void*)(features & (~1));
38899 features_conv.is_owned = false;
38900 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
38901 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
38905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38906 if ((this_ptr & 1) != 0) return;
38907 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38908 CHECK_ACCESS(this_ptr_ptr);
38909 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
38910 FREE((void*)this_ptr);
38911 CustomMessageReader_free(this_ptr_conv);
38914 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
38915 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
38916 *ret_ret = Type_clone(arg);
38917 return (uintptr_t)ret_ret;
38919 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38920 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
38921 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
38922 LDKType* arg_conv = (LDKType*)arg_ptr;
38923 intptr_t ret_val = Type_clone_ptr(arg_conv);
38927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38928 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
38929 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
38930 LDKType* orig_conv = (LDKType*)orig_ptr;
38931 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
38932 *ret_ret = Type_clone(orig_conv);
38933 return (uintptr_t)ret_ret;
38936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38937 if ((this_ptr & 1) != 0) return;
38938 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38939 CHECK_ACCESS(this_ptr_ptr);
38940 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
38941 FREE((void*)this_ptr);
38942 Type_free(this_ptr_conv);
38945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38946 LDKNodeId this_obj_conv;
38947 this_obj_conv.inner = (void*)(this_obj & (~1));
38948 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38950 NodeId_free(this_obj_conv);
38953 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
38954 LDKNodeId ret_var = NodeId_clone(arg);
38955 uintptr_t ret_ref = 0;
38956 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38957 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38959 ret_ref = (uintptr_t)ret_var.inner;
38960 if (ret_var.is_owned) {
38965 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38966 LDKNodeId arg_conv;
38967 arg_conv.inner = (void*)(arg & (~1));
38968 arg_conv.is_owned = false;
38969 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38970 intptr_t ret_val = NodeId_clone_ptr(&arg_conv);
38974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38975 LDKNodeId orig_conv;
38976 orig_conv.inner = (void*)(orig & (~1));
38977 orig_conv.is_owned = false;
38978 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38979 LDKNodeId ret_var = NodeId_clone(&orig_conv);
38980 uintptr_t ret_ref = 0;
38981 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38982 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38983 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38984 ret_ref = (uintptr_t)ret_var.inner;
38985 if (ret_var.is_owned) {
38991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
38992 LDKPublicKey pubkey_ref;
38993 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
38994 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
38995 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
38996 uintptr_t ret_ref = 0;
38997 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38998 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39000 ret_ref = (uintptr_t)ret_var.inner;
39001 if (ret_var.is_owned) {
39007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
39008 LDKNodeId this_arg_conv;
39009 this_arg_conv.inner = (void*)(this_arg & (~1));
39010 this_arg_conv.is_owned = false;
39011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39012 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
39013 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39014 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
39020 o_conv.inner = (void*)(o & (~1));
39021 o_conv.is_owned = false;
39022 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39023 int64_t ret_val = NodeId_hash(&o_conv);
39027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
39028 LDKNodeId obj_conv;
39029 obj_conv.inner = (void*)(obj & (~1));
39030 obj_conv.is_owned = false;
39031 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39032 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
39033 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39034 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39035 CVec_u8Z_free(ret_var);
39039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39040 LDKu8slice ser_ref;
39041 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39042 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39043 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
39044 *ret_conv = NodeId_read(ser_ref);
39045 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39046 return (uintptr_t)ret_conv;
39049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39050 LDKNetworkGraph this_obj_conv;
39051 this_obj_conv.inner = (void*)(this_obj & (~1));
39052 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39054 NetworkGraph_free(this_obj_conv);
39057 static inline uintptr_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
39058 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
39059 uintptr_t ret_ref = 0;
39060 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39061 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39063 ret_ref = (uintptr_t)ret_var.inner;
39064 if (ret_var.is_owned) {
39069 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39070 LDKNetworkGraph arg_conv;
39071 arg_conv.inner = (void*)(arg & (~1));
39072 arg_conv.is_owned = false;
39073 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39074 intptr_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
39078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39079 LDKNetworkGraph orig_conv;
39080 orig_conv.inner = (void*)(orig & (~1));
39081 orig_conv.is_owned = false;
39082 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39083 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
39084 uintptr_t ret_ref = 0;
39085 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39086 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39087 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39088 ret_ref = (uintptr_t)ret_var.inner;
39089 if (ret_var.is_owned) {
39095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39096 LDKReadOnlyNetworkGraph this_obj_conv;
39097 this_obj_conv.inner = (void*)(this_obj & (~1));
39098 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39100 ReadOnlyNetworkGraph_free(this_obj_conv);
39103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39104 if ((this_ptr & 1) != 0) return;
39105 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39106 CHECK_ACCESS(this_ptr_ptr);
39107 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
39108 FREE((void*)this_ptr);
39109 NetworkUpdate_free(this_ptr_conv);
39112 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
39113 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39114 *ret_copy = NetworkUpdate_clone(arg);
39115 uintptr_t ret_ref = (uintptr_t)ret_copy;
39118 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39119 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
39120 intptr_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
39124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39125 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
39126 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39127 *ret_copy = NetworkUpdate_clone(orig_conv);
39128 uintptr_t ret_ref = (uintptr_t)ret_copy;
39132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
39133 LDKChannelUpdate msg_conv;
39134 msg_conv.inner = (void*)(msg & (~1));
39135 msg_conv.is_owned = (msg & 1) || (msg == 0);
39136 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39137 msg_conv = ChannelUpdate_clone(&msg_conv);
39138 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39139 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
39140 uintptr_t ret_ref = (uintptr_t)ret_copy;
39144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
39145 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39146 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
39147 uintptr_t ret_ref = (uintptr_t)ret_copy;
39151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
39152 LDKPublicKey node_id_ref;
39153 CHECK((*env)->GetArrayLength(env, node_id) == 33);
39154 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
39155 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39156 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
39157 uintptr_t ret_ref = (uintptr_t)ret_copy;
39161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
39162 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
39163 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
39164 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39165 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39166 CVec_u8Z_free(ret_var);
39170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39171 LDKu8slice ser_ref;
39172 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39173 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39174 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
39175 *ret_conv = NetworkUpdate_read(ser_ref);
39176 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39177 return (uintptr_t)ret_conv;
39180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
39181 LDKNetGraphMsgHandler this_arg_conv;
39182 this_arg_conv.inner = (void*)(this_arg & (~1));
39183 this_arg_conv.is_owned = false;
39184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39185 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
39186 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
39187 return (uintptr_t)ret_ret;
39190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39191 LDKNetGraphMsgHandler this_obj_conv;
39192 this_obj_conv.inner = (void*)(this_obj & (~1));
39193 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39195 NetGraphMsgHandler_free(this_obj_conv);
39198 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) {
39199 LDKNetworkGraph network_graph_conv;
39200 network_graph_conv.inner = (void*)(network_graph & (~1));
39201 network_graph_conv.is_owned = false;
39202 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
39203 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39204 CHECK_ACCESS(chain_access_ptr);
39205 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39206 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39207 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39208 // Manually implement clone for Java trait instances
39209 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39210 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39211 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39214 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
39215 CHECK_ACCESS(logger_ptr);
39216 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39217 if (logger_conv.free == LDKLogger_JCalls_free) {
39218 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39219 LDKLogger_JCalls_cloned(&logger_conv);
39221 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
39222 uintptr_t ret_ref = 0;
39223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39226 ret_ref = (uintptr_t)ret_var.inner;
39227 if (ret_var.is_owned) {
39233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
39234 LDKNetGraphMsgHandler this_arg_conv;
39235 this_arg_conv.inner = (void*)(this_arg & (~1));
39236 this_arg_conv.is_owned = false;
39237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39238 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39239 CHECK_ACCESS(chain_access_ptr);
39240 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39241 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39242 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39243 // Manually implement clone for Java trait instances
39244 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39245 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39246 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39249 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
39252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
39253 LDKNetGraphMsgHandler this_arg_conv;
39254 this_arg_conv.inner = (void*)(this_arg & (~1));
39255 this_arg_conv.is_owned = false;
39256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39257 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
39258 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
39259 return (uintptr_t)ret_ret;
39262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
39263 LDKNetGraphMsgHandler this_arg_conv;
39264 this_arg_conv.inner = (void*)(this_arg & (~1));
39265 this_arg_conv.is_owned = false;
39266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39267 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
39268 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
39269 return (uintptr_t)ret_ret;
39272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39273 LDKChannelUpdateInfo this_obj_conv;
39274 this_obj_conv.inner = (void*)(this_obj & (~1));
39275 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39277 ChannelUpdateInfo_free(this_obj_conv);
39280 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
39281 LDKChannelUpdateInfo this_ptr_conv;
39282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39283 this_ptr_conv.is_owned = false;
39284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39285 int32_t ret_val = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
39289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39290 LDKChannelUpdateInfo this_ptr_conv;
39291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39292 this_ptr_conv.is_owned = false;
39293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39294 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
39297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
39298 LDKChannelUpdateInfo this_ptr_conv;
39299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39300 this_ptr_conv.is_owned = false;
39301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39302 jboolean ret_val = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
39306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39307 LDKChannelUpdateInfo this_ptr_conv;
39308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39309 this_ptr_conv.is_owned = false;
39310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39311 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
39314 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39315 LDKChannelUpdateInfo this_ptr_conv;
39316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39317 this_ptr_conv.is_owned = false;
39318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39319 int16_t ret_val = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
39323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39324 LDKChannelUpdateInfo this_ptr_conv;
39325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39326 this_ptr_conv.is_owned = false;
39327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39328 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
39331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39332 LDKChannelUpdateInfo this_ptr_conv;
39333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39334 this_ptr_conv.is_owned = false;
39335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39336 int64_t ret_val = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
39340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39341 LDKChannelUpdateInfo this_ptr_conv;
39342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39343 this_ptr_conv.is_owned = false;
39344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39345 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
39348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39349 LDKChannelUpdateInfo this_ptr_conv;
39350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39351 this_ptr_conv.is_owned = false;
39352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39353 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39354 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
39355 uintptr_t ret_ref = (uintptr_t)ret_copy;
39359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39360 LDKChannelUpdateInfo this_ptr_conv;
39361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39362 this_ptr_conv.is_owned = false;
39363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39364 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
39365 CHECK_ACCESS(val_ptr);
39366 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39367 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
39368 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
39371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
39372 LDKChannelUpdateInfo this_ptr_conv;
39373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39374 this_ptr_conv.is_owned = false;
39375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39376 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
39377 uintptr_t ret_ref = 0;
39378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39381 ret_ref = (uintptr_t)ret_var.inner;
39382 if (ret_var.is_owned) {
39388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39389 LDKChannelUpdateInfo this_ptr_conv;
39390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39391 this_ptr_conv.is_owned = false;
39392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39393 LDKRoutingFees val_conv;
39394 val_conv.inner = (void*)(val & (~1));
39395 val_conv.is_owned = (val & 1) || (val == 0);
39396 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39397 val_conv = RoutingFees_clone(&val_conv);
39398 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
39401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
39402 LDKChannelUpdateInfo this_ptr_conv;
39403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39404 this_ptr_conv.is_owned = false;
39405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39406 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
39407 uintptr_t ret_ref = 0;
39408 if ((uintptr_t)ret_var.inner > 4096) {
39409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39412 ret_ref = (uintptr_t)ret_var.inner;
39413 if (ret_var.is_owned) {
39420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39421 LDKChannelUpdateInfo this_ptr_conv;
39422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39423 this_ptr_conv.is_owned = false;
39424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39425 LDKChannelUpdate val_conv;
39426 val_conv.inner = (void*)(val & (~1));
39427 val_conv.is_owned = (val & 1) || (val == 0);
39428 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39429 val_conv = ChannelUpdate_clone(&val_conv);
39430 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
39433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_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) {
39434 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
39435 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
39436 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
39437 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
39438 LDKRoutingFees fees_arg_conv;
39439 fees_arg_conv.inner = (void*)(fees_arg & (~1));
39440 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
39441 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
39442 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
39443 LDKChannelUpdate last_update_message_arg_conv;
39444 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
39445 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
39446 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
39447 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
39448 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_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);
39449 uintptr_t ret_ref = 0;
39450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39453 ret_ref = (uintptr_t)ret_var.inner;
39454 if (ret_var.is_owned) {
39460 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
39461 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
39462 uintptr_t ret_ref = 0;
39463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39466 ret_ref = (uintptr_t)ret_var.inner;
39467 if (ret_var.is_owned) {
39472 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39473 LDKChannelUpdateInfo arg_conv;
39474 arg_conv.inner = (void*)(arg & (~1));
39475 arg_conv.is_owned = false;
39476 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39477 intptr_t ret_val = ChannelUpdateInfo_clone_ptr(&arg_conv);
39481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39482 LDKChannelUpdateInfo orig_conv;
39483 orig_conv.inner = (void*)(orig & (~1));
39484 orig_conv.is_owned = false;
39485 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39486 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
39487 uintptr_t ret_ref = 0;
39488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39491 ret_ref = (uintptr_t)ret_var.inner;
39492 if (ret_var.is_owned) {
39498 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
39499 LDKChannelUpdateInfo obj_conv;
39500 obj_conv.inner = (void*)(obj & (~1));
39501 obj_conv.is_owned = false;
39502 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39503 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
39504 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39505 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39506 CVec_u8Z_free(ret_var);
39510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39511 LDKu8slice ser_ref;
39512 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39513 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39514 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
39515 *ret_conv = ChannelUpdateInfo_read(ser_ref);
39516 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39517 return (uintptr_t)ret_conv;
39520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39521 LDKChannelInfo this_obj_conv;
39522 this_obj_conv.inner = (void*)(this_obj & (~1));
39523 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39525 ChannelInfo_free(this_obj_conv);
39528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
39529 LDKChannelInfo this_ptr_conv;
39530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39531 this_ptr_conv.is_owned = false;
39532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39533 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
39534 uintptr_t ret_ref = 0;
39535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39538 ret_ref = (uintptr_t)ret_var.inner;
39539 if (ret_var.is_owned) {
39545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39546 LDKChannelInfo this_ptr_conv;
39547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39548 this_ptr_conv.is_owned = false;
39549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39550 LDKChannelFeatures val_conv;
39551 val_conv.inner = (void*)(val & (~1));
39552 val_conv.is_owned = (val & 1) || (val == 0);
39553 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39554 val_conv = ChannelFeatures_clone(&val_conv);
39555 ChannelInfo_set_features(&this_ptr_conv, val_conv);
39558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
39559 LDKChannelInfo this_ptr_conv;
39560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39561 this_ptr_conv.is_owned = false;
39562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39563 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
39564 uintptr_t ret_ref = 0;
39565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39568 ret_ref = (uintptr_t)ret_var.inner;
39569 if (ret_var.is_owned) {
39575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39576 LDKChannelInfo this_ptr_conv;
39577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39578 this_ptr_conv.is_owned = false;
39579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39580 LDKNodeId val_conv;
39581 val_conv.inner = (void*)(val & (~1));
39582 val_conv.is_owned = (val & 1) || (val == 0);
39583 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39584 val_conv = NodeId_clone(&val_conv);
39585 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
39588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
39589 LDKChannelInfo this_ptr_conv;
39590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39591 this_ptr_conv.is_owned = false;
39592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39593 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
39594 uintptr_t ret_ref = 0;
39595 if ((uintptr_t)ret_var.inner > 4096) {
39596 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39597 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39599 ret_ref = (uintptr_t)ret_var.inner;
39600 if (ret_var.is_owned) {
39607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39608 LDKChannelInfo this_ptr_conv;
39609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39610 this_ptr_conv.is_owned = false;
39611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39612 LDKChannelUpdateInfo val_conv;
39613 val_conv.inner = (void*)(val & (~1));
39614 val_conv.is_owned = (val & 1) || (val == 0);
39615 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39616 val_conv = ChannelUpdateInfo_clone(&val_conv);
39617 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
39620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
39621 LDKChannelInfo this_ptr_conv;
39622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39623 this_ptr_conv.is_owned = false;
39624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39625 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
39626 uintptr_t ret_ref = 0;
39627 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39628 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39630 ret_ref = (uintptr_t)ret_var.inner;
39631 if (ret_var.is_owned) {
39637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39638 LDKChannelInfo this_ptr_conv;
39639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39640 this_ptr_conv.is_owned = false;
39641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39642 LDKNodeId val_conv;
39643 val_conv.inner = (void*)(val & (~1));
39644 val_conv.is_owned = (val & 1) || (val == 0);
39645 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39646 val_conv = NodeId_clone(&val_conv);
39647 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
39650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
39651 LDKChannelInfo this_ptr_conv;
39652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39653 this_ptr_conv.is_owned = false;
39654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39655 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
39656 uintptr_t ret_ref = 0;
39657 if ((uintptr_t)ret_var.inner > 4096) {
39658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39661 ret_ref = (uintptr_t)ret_var.inner;
39662 if (ret_var.is_owned) {
39669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39670 LDKChannelInfo this_ptr_conv;
39671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39672 this_ptr_conv.is_owned = false;
39673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39674 LDKChannelUpdateInfo val_conv;
39675 val_conv.inner = (void*)(val & (~1));
39676 val_conv.is_owned = (val & 1) || (val == 0);
39677 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39678 val_conv = ChannelUpdateInfo_clone(&val_conv);
39679 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
39682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
39683 LDKChannelInfo this_ptr_conv;
39684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39685 this_ptr_conv.is_owned = false;
39686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39687 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39688 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
39689 uintptr_t ret_ref = (uintptr_t)ret_copy;
39693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39694 LDKChannelInfo this_ptr_conv;
39695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39696 this_ptr_conv.is_owned = false;
39697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39698 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
39699 CHECK_ACCESS(val_ptr);
39700 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39701 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
39702 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
39705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
39706 LDKChannelInfo this_ptr_conv;
39707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39708 this_ptr_conv.is_owned = false;
39709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39710 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
39711 uintptr_t ret_ref = 0;
39712 if ((uintptr_t)ret_var.inner > 4096) {
39713 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39714 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39715 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39716 ret_ref = (uintptr_t)ret_var.inner;
39717 if (ret_var.is_owned) {
39724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39725 LDKChannelInfo this_ptr_conv;
39726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39727 this_ptr_conv.is_owned = false;
39728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39729 LDKChannelAnnouncement val_conv;
39730 val_conv.inner = (void*)(val & (~1));
39731 val_conv.is_owned = (val & 1) || (val == 0);
39732 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39733 val_conv = ChannelAnnouncement_clone(&val_conv);
39734 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
39737 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
39738 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
39739 uintptr_t ret_ref = 0;
39740 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39741 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39743 ret_ref = (uintptr_t)ret_var.inner;
39744 if (ret_var.is_owned) {
39749 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39750 LDKChannelInfo arg_conv;
39751 arg_conv.inner = (void*)(arg & (~1));
39752 arg_conv.is_owned = false;
39753 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39754 intptr_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
39758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39759 LDKChannelInfo orig_conv;
39760 orig_conv.inner = (void*)(orig & (~1));
39761 orig_conv.is_owned = false;
39762 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39763 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
39764 uintptr_t ret_ref = 0;
39765 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39766 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39768 ret_ref = (uintptr_t)ret_var.inner;
39769 if (ret_var.is_owned) {
39775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
39776 LDKChannelInfo obj_conv;
39777 obj_conv.inner = (void*)(obj & (~1));
39778 obj_conv.is_owned = false;
39779 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39780 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
39781 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39782 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39783 CVec_u8Z_free(ret_var);
39787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39788 LDKu8slice ser_ref;
39789 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39790 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39791 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
39792 *ret_conv = ChannelInfo_read(ser_ref);
39793 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39794 return (uintptr_t)ret_conv;
39797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39798 LDKDirectedChannelInfo this_obj_conv;
39799 this_obj_conv.inner = (void*)(this_obj & (~1));
39800 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39802 DirectedChannelInfo_free(this_obj_conv);
39805 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
39806 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
39807 uintptr_t ret_ref = 0;
39808 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39809 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39811 ret_ref = (uintptr_t)ret_var.inner;
39812 if (ret_var.is_owned) {
39817 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39818 LDKDirectedChannelInfo arg_conv;
39819 arg_conv.inner = (void*)(arg & (~1));
39820 arg_conv.is_owned = false;
39821 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39822 intptr_t ret_val = DirectedChannelInfo_clone_ptr(&arg_conv);
39826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39827 LDKDirectedChannelInfo orig_conv;
39828 orig_conv.inner = (void*)(orig & (~1));
39829 orig_conv.is_owned = false;
39830 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39831 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
39832 uintptr_t ret_ref = 0;
39833 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39834 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39836 ret_ref = (uintptr_t)ret_var.inner;
39837 if (ret_var.is_owned) {
39843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
39844 LDKDirectedChannelInfo this_arg_conv;
39845 this_arg_conv.inner = (void*)(this_arg & (~1));
39846 this_arg_conv.is_owned = false;
39847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39848 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
39849 uintptr_t ret_ref = 0;
39850 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39851 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39853 ret_ref = (uintptr_t)ret_var.inner;
39854 if (ret_var.is_owned) {
39860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
39861 LDKDirectedChannelInfo this_arg_conv;
39862 this_arg_conv.inner = (void*)(this_arg & (~1));
39863 this_arg_conv.is_owned = false;
39864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39865 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
39866 uintptr_t ret_ref = 0;
39867 if ((uintptr_t)ret_var.inner > 4096) {
39868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39871 ret_ref = (uintptr_t)ret_var.inner;
39872 if (ret_var.is_owned) {
39879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
39880 LDKDirectedChannelInfo this_arg_conv;
39881 this_arg_conv.inner = (void*)(this_arg & (~1));
39882 this_arg_conv.is_owned = false;
39883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39884 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39885 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
39886 uintptr_t ret_ref = (uintptr_t)ret_copy;
39890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39891 if ((this_ptr & 1) != 0) return;
39892 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39893 CHECK_ACCESS(this_ptr_ptr);
39894 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
39895 FREE((void*)this_ptr);
39896 EffectiveCapacity_free(this_ptr_conv);
39899 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
39900 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39901 *ret_copy = EffectiveCapacity_clone(arg);
39902 uintptr_t ret_ref = (uintptr_t)ret_copy;
39905 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39906 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
39907 intptr_t ret_val = EffectiveCapacity_clone_ptr(arg_conv);
39911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39912 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
39913 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39914 *ret_copy = EffectiveCapacity_clone(orig_conv);
39915 uintptr_t ret_ref = (uintptr_t)ret_copy;
39919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
39920 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39921 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
39922 uintptr_t ret_ref = (uintptr_t)ret_copy;
39926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
39927 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39928 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
39929 uintptr_t ret_ref = (uintptr_t)ret_copy;
39933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat) {
39934 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39935 *ret_copy = EffectiveCapacity_total(capacity_msat);
39936 uintptr_t ret_ref = (uintptr_t)ret_copy;
39940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
39941 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39942 *ret_copy = EffectiveCapacity_infinite();
39943 uintptr_t ret_ref = (uintptr_t)ret_copy;
39947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
39948 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39949 *ret_copy = EffectiveCapacity_unknown();
39950 uintptr_t ret_ref = (uintptr_t)ret_copy;
39954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
39955 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
39956 int64_t ret_val = EffectiveCapacity_as_msat(this_arg_conv);
39960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39961 LDKRoutingFees this_obj_conv;
39962 this_obj_conv.inner = (void*)(this_obj & (~1));
39963 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39965 RoutingFees_free(this_obj_conv);
39968 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39969 LDKRoutingFees this_ptr_conv;
39970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39971 this_ptr_conv.is_owned = false;
39972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39973 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
39977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39978 LDKRoutingFees this_ptr_conv;
39979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39980 this_ptr_conv.is_owned = false;
39981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39982 RoutingFees_set_base_msat(&this_ptr_conv, val);
39985 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
39986 LDKRoutingFees this_ptr_conv;
39987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39988 this_ptr_conv.is_owned = false;
39989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39990 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
39994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39995 LDKRoutingFees this_ptr_conv;
39996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39997 this_ptr_conv.is_owned = false;
39998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39999 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
40002 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) {
40003 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
40004 uintptr_t ret_ref = 0;
40005 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40006 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40007 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40008 ret_ref = (uintptr_t)ret_var.inner;
40009 if (ret_var.is_owned) {
40015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40016 LDKRoutingFees a_conv;
40017 a_conv.inner = (void*)(a & (~1));
40018 a_conv.is_owned = false;
40019 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40020 LDKRoutingFees b_conv;
40021 b_conv.inner = (void*)(b & (~1));
40022 b_conv.is_owned = false;
40023 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40024 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
40028 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
40029 LDKRoutingFees ret_var = RoutingFees_clone(arg);
40030 uintptr_t ret_ref = 0;
40031 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40032 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40034 ret_ref = (uintptr_t)ret_var.inner;
40035 if (ret_var.is_owned) {
40040 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40041 LDKRoutingFees arg_conv;
40042 arg_conv.inner = (void*)(arg & (~1));
40043 arg_conv.is_owned = false;
40044 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40045 intptr_t ret_val = RoutingFees_clone_ptr(&arg_conv);
40049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40050 LDKRoutingFees orig_conv;
40051 orig_conv.inner = (void*)(orig & (~1));
40052 orig_conv.is_owned = false;
40053 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40054 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
40055 uintptr_t ret_ref = 0;
40056 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40057 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40059 ret_ref = (uintptr_t)ret_var.inner;
40060 if (ret_var.is_owned) {
40066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
40067 LDKRoutingFees o_conv;
40068 o_conv.inner = (void*)(o & (~1));
40069 o_conv.is_owned = false;
40070 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40071 int64_t ret_val = RoutingFees_hash(&o_conv);
40075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
40076 LDKRoutingFees obj_conv;
40077 obj_conv.inner = (void*)(obj & (~1));
40078 obj_conv.is_owned = false;
40079 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40080 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
40081 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40082 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40083 CVec_u8Z_free(ret_var);
40087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40088 LDKu8slice ser_ref;
40089 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40090 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40091 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
40092 *ret_conv = RoutingFees_read(ser_ref);
40093 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40094 return (uintptr_t)ret_conv;
40097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40098 LDKNodeAnnouncementInfo this_obj_conv;
40099 this_obj_conv.inner = (void*)(this_obj & (~1));
40100 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40102 NodeAnnouncementInfo_free(this_obj_conv);
40105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
40106 LDKNodeAnnouncementInfo this_ptr_conv;
40107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40108 this_ptr_conv.is_owned = false;
40109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40110 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
40111 uintptr_t ret_ref = 0;
40112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40115 ret_ref = (uintptr_t)ret_var.inner;
40116 if (ret_var.is_owned) {
40122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40123 LDKNodeAnnouncementInfo this_ptr_conv;
40124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40125 this_ptr_conv.is_owned = false;
40126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40127 LDKNodeFeatures val_conv;
40128 val_conv.inner = (void*)(val & (~1));
40129 val_conv.is_owned = (val & 1) || (val == 0);
40130 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40131 val_conv = NodeFeatures_clone(&val_conv);
40132 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
40135 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
40136 LDKNodeAnnouncementInfo this_ptr_conv;
40137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40138 this_ptr_conv.is_owned = false;
40139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40140 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
40144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40145 LDKNodeAnnouncementInfo this_ptr_conv;
40146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40147 this_ptr_conv.is_owned = false;
40148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40149 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
40152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
40153 LDKNodeAnnouncementInfo this_ptr_conv;
40154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40155 this_ptr_conv.is_owned = false;
40156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40157 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
40158 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
40162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40163 LDKNodeAnnouncementInfo this_ptr_conv;
40164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40165 this_ptr_conv.is_owned = false;
40166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40167 LDKThreeBytes val_ref;
40168 CHECK((*env)->GetArrayLength(env, val) == 3);
40169 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
40170 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
40173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
40174 LDKNodeAnnouncementInfo this_ptr_conv;
40175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40176 this_ptr_conv.is_owned = false;
40177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40178 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40179 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
40183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40184 LDKNodeAnnouncementInfo this_ptr_conv;
40185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40186 this_ptr_conv.is_owned = false;
40187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40188 LDKThirtyTwoBytes val_ref;
40189 CHECK((*env)->GetArrayLength(env, val) == 32);
40190 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40191 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
40194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40195 LDKNodeAnnouncementInfo 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 LDKCVec_NetAddressZ val_constr;
40200 val_constr.datalen = (*env)->GetArrayLength(env, val);
40201 if (val_constr.datalen > 0)
40202 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40204 val_constr.data = NULL;
40205 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40206 for (size_t m = 0; m < val_constr.datalen; m++) {
40207 int64_t val_conv_12 = val_vals[m];
40208 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
40209 CHECK_ACCESS(val_conv_12_ptr);
40210 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
40211 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
40212 val_constr.data[m] = val_conv_12_conv;
40214 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40215 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
40218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
40219 LDKNodeAnnouncementInfo this_ptr_conv;
40220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40221 this_ptr_conv.is_owned = false;
40222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40223 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
40224 uintptr_t ret_ref = 0;
40225 if ((uintptr_t)ret_var.inner > 4096) {
40226 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40227 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40229 ret_ref = (uintptr_t)ret_var.inner;
40230 if (ret_var.is_owned) {
40237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40238 LDKNodeAnnouncementInfo this_ptr_conv;
40239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40240 this_ptr_conv.is_owned = false;
40241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40242 LDKNodeAnnouncement val_conv;
40243 val_conv.inner = (void*)(val & (~1));
40244 val_conv.is_owned = (val & 1) || (val == 0);
40245 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40246 val_conv = NodeAnnouncement_clone(&val_conv);
40247 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
40250 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) {
40251 LDKNodeFeatures features_arg_conv;
40252 features_arg_conv.inner = (void*)(features_arg & (~1));
40253 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
40254 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40255 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
40256 LDKThreeBytes rgb_arg_ref;
40257 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
40258 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
40259 LDKThirtyTwoBytes alias_arg_ref;
40260 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
40261 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
40262 LDKCVec_NetAddressZ addresses_arg_constr;
40263 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
40264 if (addresses_arg_constr.datalen > 0)
40265 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40267 addresses_arg_constr.data = NULL;
40268 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
40269 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
40270 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
40271 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
40272 CHECK_ACCESS(addresses_arg_conv_12_ptr);
40273 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
40274 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
40276 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
40277 LDKNodeAnnouncement announcement_message_arg_conv;
40278 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
40279 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
40280 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
40281 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
40282 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
40283 uintptr_t ret_ref = 0;
40284 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40285 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40287 ret_ref = (uintptr_t)ret_var.inner;
40288 if (ret_var.is_owned) {
40294 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
40295 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
40296 uintptr_t ret_ref = 0;
40297 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40298 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40300 ret_ref = (uintptr_t)ret_var.inner;
40301 if (ret_var.is_owned) {
40306 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40307 LDKNodeAnnouncementInfo arg_conv;
40308 arg_conv.inner = (void*)(arg & (~1));
40309 arg_conv.is_owned = false;
40310 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40311 intptr_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
40315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40316 LDKNodeAnnouncementInfo orig_conv;
40317 orig_conv.inner = (void*)(orig & (~1));
40318 orig_conv.is_owned = false;
40319 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40320 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
40321 uintptr_t ret_ref = 0;
40322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40325 ret_ref = (uintptr_t)ret_var.inner;
40326 if (ret_var.is_owned) {
40332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
40333 LDKNodeAnnouncementInfo obj_conv;
40334 obj_conv.inner = (void*)(obj & (~1));
40335 obj_conv.is_owned = false;
40336 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40337 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
40338 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40339 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40340 CVec_u8Z_free(ret_var);
40344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40345 LDKu8slice ser_ref;
40346 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40347 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40348 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
40349 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
40350 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40351 return (uintptr_t)ret_conv;
40354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40355 LDKNodeInfo this_obj_conv;
40356 this_obj_conv.inner = (void*)(this_obj & (~1));
40357 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40359 NodeInfo_free(this_obj_conv);
40362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40363 LDKNodeInfo this_ptr_conv;
40364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40365 this_ptr_conv.is_owned = false;
40366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40367 LDKCVec_u64Z val_constr;
40368 val_constr.datalen = (*env)->GetArrayLength(env, val);
40369 if (val_constr.datalen > 0)
40370 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40372 val_constr.data = NULL;
40373 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40374 for (size_t g = 0; g < val_constr.datalen; g++) {
40375 int64_t val_conv_6 = val_vals[g];
40376 val_constr.data[g] = val_conv_6;
40378 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40379 NodeInfo_set_channels(&this_ptr_conv, val_constr);
40382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
40383 LDKNodeInfo this_ptr_conv;
40384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40385 this_ptr_conv.is_owned = false;
40386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40387 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
40388 uintptr_t ret_ref = 0;
40389 if ((uintptr_t)ret_var.inner > 4096) {
40390 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40391 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40392 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40393 ret_ref = (uintptr_t)ret_var.inner;
40394 if (ret_var.is_owned) {
40401 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) {
40402 LDKNodeInfo this_ptr_conv;
40403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40404 this_ptr_conv.is_owned = false;
40405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40406 LDKRoutingFees val_conv;
40407 val_conv.inner = (void*)(val & (~1));
40408 val_conv.is_owned = (val & 1) || (val == 0);
40409 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40410 val_conv = RoutingFees_clone(&val_conv);
40411 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
40414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
40415 LDKNodeInfo this_ptr_conv;
40416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40417 this_ptr_conv.is_owned = false;
40418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40419 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
40420 uintptr_t ret_ref = 0;
40421 if ((uintptr_t)ret_var.inner > 4096) {
40422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40425 ret_ref = (uintptr_t)ret_var.inner;
40426 if (ret_var.is_owned) {
40433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40434 LDKNodeInfo this_ptr_conv;
40435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40436 this_ptr_conv.is_owned = false;
40437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40438 LDKNodeAnnouncementInfo val_conv;
40439 val_conv.inner = (void*)(val & (~1));
40440 val_conv.is_owned = (val & 1) || (val == 0);
40441 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40442 val_conv = NodeAnnouncementInfo_clone(&val_conv);
40443 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
40446 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) {
40447 LDKCVec_u64Z channels_arg_constr;
40448 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
40449 if (channels_arg_constr.datalen > 0)
40450 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40452 channels_arg_constr.data = NULL;
40453 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
40454 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
40455 int64_t channels_arg_conv_6 = channels_arg_vals[g];
40456 channels_arg_constr.data[g] = channels_arg_conv_6;
40458 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
40459 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
40460 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
40461 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
40462 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
40463 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
40464 LDKNodeAnnouncementInfo announcement_info_arg_conv;
40465 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
40466 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
40467 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
40468 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
40469 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
40470 uintptr_t ret_ref = 0;
40471 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40472 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40474 ret_ref = (uintptr_t)ret_var.inner;
40475 if (ret_var.is_owned) {
40481 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
40482 LDKNodeInfo ret_var = NodeInfo_clone(arg);
40483 uintptr_t ret_ref = 0;
40484 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40485 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40487 ret_ref = (uintptr_t)ret_var.inner;
40488 if (ret_var.is_owned) {
40493 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40494 LDKNodeInfo arg_conv;
40495 arg_conv.inner = (void*)(arg & (~1));
40496 arg_conv.is_owned = false;
40497 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40498 intptr_t ret_val = NodeInfo_clone_ptr(&arg_conv);
40502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40503 LDKNodeInfo orig_conv;
40504 orig_conv.inner = (void*)(orig & (~1));
40505 orig_conv.is_owned = false;
40506 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40507 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
40508 uintptr_t ret_ref = 0;
40509 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40510 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40512 ret_ref = (uintptr_t)ret_var.inner;
40513 if (ret_var.is_owned) {
40519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
40520 LDKNodeInfo obj_conv;
40521 obj_conv.inner = (void*)(obj & (~1));
40522 obj_conv.is_owned = false;
40523 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40524 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
40525 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40526 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40527 CVec_u8Z_free(ret_var);
40531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40532 LDKu8slice ser_ref;
40533 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40534 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40535 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
40536 *ret_conv = NodeInfo_read(ser_ref);
40537 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40538 return (uintptr_t)ret_conv;
40541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
40542 LDKNetworkGraph obj_conv;
40543 obj_conv.inner = (void*)(obj & (~1));
40544 obj_conv.is_owned = false;
40545 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40546 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
40547 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40548 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40549 CVec_u8Z_free(ret_var);
40553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40554 LDKu8slice ser_ref;
40555 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40556 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40557 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
40558 *ret_conv = NetworkGraph_read(ser_ref);
40559 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40560 return (uintptr_t)ret_conv;
40563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
40564 LDKThirtyTwoBytes genesis_hash_ref;
40565 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
40566 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
40567 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
40568 uintptr_t ret_ref = 0;
40569 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40570 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40572 ret_ref = (uintptr_t)ret_var.inner;
40573 if (ret_var.is_owned) {
40579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
40580 LDKNetworkGraph this_arg_conv;
40581 this_arg_conv.inner = (void*)(this_arg & (~1));
40582 this_arg_conv.is_owned = false;
40583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40584 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
40585 uintptr_t ret_ref = 0;
40586 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40587 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40588 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40589 ret_ref = (uintptr_t)ret_var.inner;
40590 if (ret_var.is_owned) {
40596 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) {
40597 LDKNetworkGraph this_arg_conv;
40598 this_arg_conv.inner = (void*)(this_arg & (~1));
40599 this_arg_conv.is_owned = false;
40600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40601 LDKNodeAnnouncement msg_conv;
40602 msg_conv.inner = (void*)(msg & (~1));
40603 msg_conv.is_owned = false;
40604 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40605 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40606 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
40607 return (uintptr_t)ret_conv;
40610 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) {
40611 LDKNetworkGraph this_arg_conv;
40612 this_arg_conv.inner = (void*)(this_arg & (~1));
40613 this_arg_conv.is_owned = false;
40614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40615 LDKUnsignedNodeAnnouncement msg_conv;
40616 msg_conv.inner = (void*)(msg & (~1));
40617 msg_conv.is_owned = false;
40618 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40619 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40620 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
40621 return (uintptr_t)ret_conv;
40624 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) {
40625 LDKNetworkGraph this_arg_conv;
40626 this_arg_conv.inner = (void*)(this_arg & (~1));
40627 this_arg_conv.is_owned = false;
40628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40629 LDKChannelAnnouncement msg_conv;
40630 msg_conv.inner = (void*)(msg & (~1));
40631 msg_conv.is_owned = false;
40632 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40633 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
40634 CHECK_ACCESS(chain_access_ptr);
40635 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40636 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40637 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40638 // Manually implement clone for Java trait instances
40639 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40640 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40641 LDKAccess_JCalls_cloned(&chain_access_conv.some);
40644 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40645 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
40646 return (uintptr_t)ret_conv;
40649 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) {
40650 LDKNetworkGraph this_arg_conv;
40651 this_arg_conv.inner = (void*)(this_arg & (~1));
40652 this_arg_conv.is_owned = false;
40653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40654 LDKUnsignedChannelAnnouncement msg_conv;
40655 msg_conv.inner = (void*)(msg & (~1));
40656 msg_conv.is_owned = false;
40657 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40658 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
40659 CHECK_ACCESS(chain_access_ptr);
40660 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40661 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40662 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40663 // Manually implement clone for Java trait instances
40664 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40665 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40666 LDKAccess_JCalls_cloned(&chain_access_conv.some);
40669 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40670 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
40671 return (uintptr_t)ret_conv;
40674 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) {
40675 LDKNetworkGraph this_arg_conv;
40676 this_arg_conv.inner = (void*)(this_arg & (~1));
40677 this_arg_conv.is_owned = false;
40678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40679 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
40682 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) {
40683 LDKNetworkGraph this_arg_conv;
40684 this_arg_conv.inner = (void*)(this_arg & (~1));
40685 this_arg_conv.is_owned = false;
40686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40687 LDKPublicKey _node_id_ref;
40688 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
40689 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
40690 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
40693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
40694 LDKNetworkGraph this_arg_conv;
40695 this_arg_conv.inner = (void*)(this_arg & (~1));
40696 this_arg_conv.is_owned = false;
40697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40698 NetworkGraph_remove_stale_channels(&this_arg_conv);
40701 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) {
40702 LDKNetworkGraph this_arg_conv;
40703 this_arg_conv.inner = (void*)(this_arg & (~1));
40704 this_arg_conv.is_owned = false;
40705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40706 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
40709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
40710 LDKNetworkGraph this_arg_conv;
40711 this_arg_conv.inner = (void*)(this_arg & (~1));
40712 this_arg_conv.is_owned = false;
40713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40714 LDKChannelUpdate msg_conv;
40715 msg_conv.inner = (void*)(msg & (~1));
40716 msg_conv.is_owned = false;
40717 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40718 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40719 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
40720 return (uintptr_t)ret_conv;
40723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
40724 LDKNetworkGraph this_arg_conv;
40725 this_arg_conv.inner = (void*)(this_arg & (~1));
40726 this_arg_conv.is_owned = false;
40727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40728 LDKUnsignedChannelUpdate msg_conv;
40729 msg_conv.inner = (void*)(msg & (~1));
40730 msg_conv.is_owned = false;
40731 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40732 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40733 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
40734 return (uintptr_t)ret_conv;
40737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
40738 LDKReadOnlyNetworkGraph this_arg_conv;
40739 this_arg_conv.inner = (void*)(this_arg & (~1));
40740 this_arg_conv.is_owned = false;
40741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40742 LDKPublicKey pubkey_ref;
40743 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
40744 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
40745 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
40746 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
40747 uintptr_t ret_ref = (uintptr_t)ret_copy;
40751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40752 LDKRouteHop this_obj_conv;
40753 this_obj_conv.inner = (void*)(this_obj & (~1));
40754 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40756 RouteHop_free(this_obj_conv);
40759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40760 LDKRouteHop this_ptr_conv;
40761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40762 this_ptr_conv.is_owned = false;
40763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40764 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40765 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
40769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40770 LDKRouteHop this_ptr_conv;
40771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40772 this_ptr_conv.is_owned = false;
40773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40774 LDKPublicKey val_ref;
40775 CHECK((*env)->GetArrayLength(env, val) == 33);
40776 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40777 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
40780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
40781 LDKRouteHop this_ptr_conv;
40782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40783 this_ptr_conv.is_owned = false;
40784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40785 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
40786 uintptr_t ret_ref = 0;
40787 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40788 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40789 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40790 ret_ref = (uintptr_t)ret_var.inner;
40791 if (ret_var.is_owned) {
40797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40798 LDKRouteHop this_ptr_conv;
40799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40800 this_ptr_conv.is_owned = false;
40801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40802 LDKNodeFeatures val_conv;
40803 val_conv.inner = (void*)(val & (~1));
40804 val_conv.is_owned = (val & 1) || (val == 0);
40805 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40806 val_conv = NodeFeatures_clone(&val_conv);
40807 RouteHop_set_node_features(&this_ptr_conv, val_conv);
40810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
40811 LDKRouteHop this_ptr_conv;
40812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40813 this_ptr_conv.is_owned = false;
40814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40815 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
40819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40820 LDKRouteHop this_ptr_conv;
40821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40822 this_ptr_conv.is_owned = false;
40823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40824 RouteHop_set_short_channel_id(&this_ptr_conv, val);
40827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
40828 LDKRouteHop this_ptr_conv;
40829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40830 this_ptr_conv.is_owned = false;
40831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40832 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
40833 uintptr_t ret_ref = 0;
40834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40837 ret_ref = (uintptr_t)ret_var.inner;
40838 if (ret_var.is_owned) {
40844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40845 LDKRouteHop this_ptr_conv;
40846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40847 this_ptr_conv.is_owned = false;
40848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40849 LDKChannelFeatures val_conv;
40850 val_conv.inner = (void*)(val & (~1));
40851 val_conv.is_owned = (val & 1) || (val == 0);
40852 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40853 val_conv = ChannelFeatures_clone(&val_conv);
40854 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
40857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40858 LDKRouteHop this_ptr_conv;
40859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40860 this_ptr_conv.is_owned = false;
40861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40862 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
40866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40867 LDKRouteHop this_ptr_conv;
40868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40869 this_ptr_conv.is_owned = false;
40870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40871 RouteHop_set_fee_msat(&this_ptr_conv, val);
40874 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
40875 LDKRouteHop this_ptr_conv;
40876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40877 this_ptr_conv.is_owned = false;
40878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40879 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
40883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40884 LDKRouteHop this_ptr_conv;
40885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40886 this_ptr_conv.is_owned = false;
40887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40888 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
40891 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) {
40892 LDKPublicKey pubkey_arg_ref;
40893 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
40894 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
40895 LDKNodeFeatures node_features_arg_conv;
40896 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
40897 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
40898 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
40899 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
40900 LDKChannelFeatures channel_features_arg_conv;
40901 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
40902 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
40903 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
40904 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
40905 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);
40906 uintptr_t ret_ref = 0;
40907 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40908 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40910 ret_ref = (uintptr_t)ret_var.inner;
40911 if (ret_var.is_owned) {
40917 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
40918 LDKRouteHop ret_var = RouteHop_clone(arg);
40919 uintptr_t ret_ref = 0;
40920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40923 ret_ref = (uintptr_t)ret_var.inner;
40924 if (ret_var.is_owned) {
40929 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40930 LDKRouteHop arg_conv;
40931 arg_conv.inner = (void*)(arg & (~1));
40932 arg_conv.is_owned = false;
40933 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40934 intptr_t ret_val = RouteHop_clone_ptr(&arg_conv);
40938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40939 LDKRouteHop orig_conv;
40940 orig_conv.inner = (void*)(orig & (~1));
40941 orig_conv.is_owned = false;
40942 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40943 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
40944 uintptr_t ret_ref = 0;
40945 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40946 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40948 ret_ref = (uintptr_t)ret_var.inner;
40949 if (ret_var.is_owned) {
40955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
40956 LDKRouteHop o_conv;
40957 o_conv.inner = (void*)(o & (~1));
40958 o_conv.is_owned = false;
40959 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40960 int64_t ret_val = RouteHop_hash(&o_conv);
40964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40965 LDKRouteHop a_conv;
40966 a_conv.inner = (void*)(a & (~1));
40967 a_conv.is_owned = false;
40968 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40969 LDKRouteHop b_conv;
40970 b_conv.inner = (void*)(b & (~1));
40971 b_conv.is_owned = false;
40972 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40973 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
40977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
40978 LDKRouteHop obj_conv;
40979 obj_conv.inner = (void*)(obj & (~1));
40980 obj_conv.is_owned = false;
40981 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40982 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
40983 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40984 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40985 CVec_u8Z_free(ret_var);
40989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40990 LDKu8slice ser_ref;
40991 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40992 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40993 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
40994 *ret_conv = RouteHop_read(ser_ref);
40995 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40996 return (uintptr_t)ret_conv;
40999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41000 LDKRoute this_obj_conv;
41001 this_obj_conv.inner = (void*)(this_obj & (~1));
41002 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41004 Route_free(this_obj_conv);
41007 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
41008 LDKRoute this_ptr_conv;
41009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41010 this_ptr_conv.is_owned = false;
41011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41012 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
41013 jobjectArray ret_arr = NULL;
41014 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
41016 for (size_t m = 0; m < ret_var.datalen; m++) {
41017 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
41018 int64_tArray ret_conv_12_arr = NULL;
41019 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
41020 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
41021 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
41022 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
41023 uintptr_t ret_conv_12_conv_10_ref = 0;
41024 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41025 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
41027 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
41028 if (ret_conv_12_conv_10_var.is_owned) {
41029 ret_conv_12_conv_10_ref |= 1;
41031 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
41033 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
41034 FREE(ret_conv_12_var.data);
41035 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
41038 FREE(ret_var.data);
41042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
41043 LDKRoute this_ptr_conv;
41044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41045 this_ptr_conv.is_owned = false;
41046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41047 LDKCVec_CVec_RouteHopZZ val_constr;
41048 val_constr.datalen = (*env)->GetArrayLength(env, val);
41049 if (val_constr.datalen > 0)
41050 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41052 val_constr.data = NULL;
41053 for (size_t m = 0; m < val_constr.datalen; m++) {
41054 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
41055 LDKCVec_RouteHopZ val_conv_12_constr;
41056 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
41057 if (val_conv_12_constr.datalen > 0)
41058 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41060 val_conv_12_constr.data = NULL;
41061 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
41062 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
41063 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
41064 LDKRouteHop val_conv_12_conv_10_conv;
41065 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
41066 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
41067 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
41068 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
41069 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
41071 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
41072 val_constr.data[m] = val_conv_12_constr;
41074 Route_set_paths(&this_ptr_conv, val_constr);
41077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
41078 LDKRoute this_ptr_conv;
41079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41080 this_ptr_conv.is_owned = false;
41081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41082 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
41083 uintptr_t ret_ref = 0;
41084 if ((uintptr_t)ret_var.inner > 4096) {
41085 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41086 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41087 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41088 ret_ref = (uintptr_t)ret_var.inner;
41089 if (ret_var.is_owned) {
41096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41097 LDKRoute this_ptr_conv;
41098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41099 this_ptr_conv.is_owned = false;
41100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41101 LDKPaymentParameters val_conv;
41102 val_conv.inner = (void*)(val & (~1));
41103 val_conv.is_owned = (val & 1) || (val == 0);
41104 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41105 val_conv = PaymentParameters_clone(&val_conv);
41106 Route_set_payment_params(&this_ptr_conv, val_conv);
41109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
41110 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
41111 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
41112 if (paths_arg_constr.datalen > 0)
41113 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41115 paths_arg_constr.data = NULL;
41116 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
41117 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
41118 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
41119 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
41120 if (paths_arg_conv_12_constr.datalen > 0)
41121 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41123 paths_arg_conv_12_constr.data = NULL;
41124 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
41125 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
41126 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
41127 LDKRouteHop paths_arg_conv_12_conv_10_conv;
41128 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
41129 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
41130 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
41131 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
41132 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
41134 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
41135 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
41137 LDKPaymentParameters payment_params_arg_conv;
41138 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
41139 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
41140 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41141 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41142 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
41143 uintptr_t ret_ref = 0;
41144 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41145 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41147 ret_ref = (uintptr_t)ret_var.inner;
41148 if (ret_var.is_owned) {
41154 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
41155 LDKRoute ret_var = Route_clone(arg);
41156 uintptr_t ret_ref = 0;
41157 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41158 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41159 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41160 ret_ref = (uintptr_t)ret_var.inner;
41161 if (ret_var.is_owned) {
41166 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41168 arg_conv.inner = (void*)(arg & (~1));
41169 arg_conv.is_owned = false;
41170 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41171 intptr_t ret_val = Route_clone_ptr(&arg_conv);
41175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41176 LDKRoute orig_conv;
41177 orig_conv.inner = (void*)(orig & (~1));
41178 orig_conv.is_owned = false;
41179 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41180 LDKRoute ret_var = Route_clone(&orig_conv);
41181 uintptr_t ret_ref = 0;
41182 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41183 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41184 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41185 ret_ref = (uintptr_t)ret_var.inner;
41186 if (ret_var.is_owned) {
41192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
41194 o_conv.inner = (void*)(o & (~1));
41195 o_conv.is_owned = false;
41196 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41197 int64_t ret_val = Route_hash(&o_conv);
41201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41203 a_conv.inner = (void*)(a & (~1));
41204 a_conv.is_owned = false;
41205 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41207 b_conv.inner = (void*)(b & (~1));
41208 b_conv.is_owned = false;
41209 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41210 jboolean ret_val = Route_eq(&a_conv, &b_conv);
41214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
41215 LDKRoute this_arg_conv;
41216 this_arg_conv.inner = (void*)(this_arg & (~1));
41217 this_arg_conv.is_owned = false;
41218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41219 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
41223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
41224 LDKRoute this_arg_conv;
41225 this_arg_conv.inner = (void*)(this_arg & (~1));
41226 this_arg_conv.is_owned = false;
41227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41228 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
41232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
41234 obj_conv.inner = (void*)(obj & (~1));
41235 obj_conv.is_owned = false;
41236 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41237 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
41238 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41239 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41240 CVec_u8Z_free(ret_var);
41244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41245 LDKu8slice ser_ref;
41246 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41247 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41248 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
41249 *ret_conv = Route_read(ser_ref);
41250 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41251 return (uintptr_t)ret_conv;
41254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41255 LDKRouteParameters this_obj_conv;
41256 this_obj_conv.inner = (void*)(this_obj & (~1));
41257 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41259 RouteParameters_free(this_obj_conv);
41262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
41263 LDKRouteParameters this_ptr_conv;
41264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41265 this_ptr_conv.is_owned = false;
41266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41267 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
41268 uintptr_t ret_ref = 0;
41269 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41270 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41271 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41272 ret_ref = (uintptr_t)ret_var.inner;
41273 if (ret_var.is_owned) {
41279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41280 LDKRouteParameters this_ptr_conv;
41281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41282 this_ptr_conv.is_owned = false;
41283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41284 LDKPaymentParameters val_conv;
41285 val_conv.inner = (void*)(val & (~1));
41286 val_conv.is_owned = (val & 1) || (val == 0);
41287 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41288 val_conv = PaymentParameters_clone(&val_conv);
41289 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
41292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41293 LDKRouteParameters this_ptr_conv;
41294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41295 this_ptr_conv.is_owned = false;
41296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41297 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
41301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41302 LDKRouteParameters this_ptr_conv;
41303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41304 this_ptr_conv.is_owned = false;
41305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41306 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
41309 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41310 LDKRouteParameters this_ptr_conv;
41311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41312 this_ptr_conv.is_owned = false;
41313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41314 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
41318 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) {
41319 LDKRouteParameters this_ptr_conv;
41320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41321 this_ptr_conv.is_owned = false;
41322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41323 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
41326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payment_params_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
41327 LDKPaymentParameters payment_params_arg_conv;
41328 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
41329 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
41330 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41331 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41332 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
41333 uintptr_t ret_ref = 0;
41334 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41335 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41336 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41337 ret_ref = (uintptr_t)ret_var.inner;
41338 if (ret_var.is_owned) {
41344 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
41345 LDKRouteParameters ret_var = RouteParameters_clone(arg);
41346 uintptr_t ret_ref = 0;
41347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41350 ret_ref = (uintptr_t)ret_var.inner;
41351 if (ret_var.is_owned) {
41356 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41357 LDKRouteParameters arg_conv;
41358 arg_conv.inner = (void*)(arg & (~1));
41359 arg_conv.is_owned = false;
41360 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41361 intptr_t ret_val = RouteParameters_clone_ptr(&arg_conv);
41365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41366 LDKRouteParameters orig_conv;
41367 orig_conv.inner = (void*)(orig & (~1));
41368 orig_conv.is_owned = false;
41369 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41370 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
41371 uintptr_t ret_ref = 0;
41372 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41373 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41375 ret_ref = (uintptr_t)ret_var.inner;
41376 if (ret_var.is_owned) {
41382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
41383 LDKRouteParameters obj_conv;
41384 obj_conv.inner = (void*)(obj & (~1));
41385 obj_conv.is_owned = false;
41386 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41387 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
41388 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41389 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41390 CVec_u8Z_free(ret_var);
41394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41395 LDKu8slice ser_ref;
41396 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41397 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41398 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
41399 *ret_conv = RouteParameters_read(ser_ref);
41400 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41401 return (uintptr_t)ret_conv;
41404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41405 LDKPaymentParameters this_obj_conv;
41406 this_obj_conv.inner = (void*)(this_obj & (~1));
41407 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41409 PaymentParameters_free(this_obj_conv);
41412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41413 LDKPaymentParameters this_ptr_conv;
41414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41415 this_ptr_conv.is_owned = false;
41416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41417 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41418 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
41422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41423 LDKPaymentParameters this_ptr_conv;
41424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41425 this_ptr_conv.is_owned = false;
41426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41427 LDKPublicKey val_ref;
41428 CHECK((*env)->GetArrayLength(env, val) == 33);
41429 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41430 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
41433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41434 LDKPaymentParameters this_ptr_conv;
41435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41436 this_ptr_conv.is_owned = false;
41437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41438 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
41439 uintptr_t ret_ref = 0;
41440 if ((uintptr_t)ret_var.inner > 4096) {
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) {
41452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41453 LDKPaymentParameters this_ptr_conv;
41454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41455 this_ptr_conv.is_owned = false;
41456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41457 LDKInvoiceFeatures val_conv;
41458 val_conv.inner = (void*)(val & (~1));
41459 val_conv.is_owned = (val & 1) || (val == 0);
41460 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41461 val_conv = InvoiceFeatures_clone(&val_conv);
41462 PaymentParameters_set_features(&this_ptr_conv, val_conv);
41465 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
41466 LDKPaymentParameters this_ptr_conv;
41467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41468 this_ptr_conv.is_owned = false;
41469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41470 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
41471 int64_tArray ret_arr = NULL;
41472 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41473 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41474 for (size_t l = 0; l < ret_var.datalen; l++) {
41475 LDKRouteHint ret_conv_11_var = ret_var.data[l];
41476 uintptr_t ret_conv_11_ref = 0;
41477 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41478 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
41480 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
41481 if (ret_conv_11_var.is_owned) {
41482 ret_conv_11_ref |= 1;
41484 ret_arr_ptr[l] = ret_conv_11_ref;
41486 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41487 FREE(ret_var.data);
41491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
41492 LDKPaymentParameters this_ptr_conv;
41493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41494 this_ptr_conv.is_owned = false;
41495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41496 LDKCVec_RouteHintZ val_constr;
41497 val_constr.datalen = (*env)->GetArrayLength(env, val);
41498 if (val_constr.datalen > 0)
41499 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
41501 val_constr.data = NULL;
41502 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
41503 for (size_t l = 0; l < val_constr.datalen; l++) {
41504 int64_t val_conv_11 = val_vals[l];
41505 LDKRouteHint val_conv_11_conv;
41506 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
41507 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
41508 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
41509 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
41510 val_constr.data[l] = val_conv_11_conv;
41512 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
41513 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
41516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
41517 LDKPaymentParameters this_ptr_conv;
41518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41519 this_ptr_conv.is_owned = false;
41520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41521 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41522 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
41523 uintptr_t ret_ref = (uintptr_t)ret_copy;
41527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41528 LDKPaymentParameters this_ptr_conv;
41529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41530 this_ptr_conv.is_owned = false;
41531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41532 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41533 CHECK_ACCESS(val_ptr);
41534 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41535 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
41536 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
41539 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41540 LDKPaymentParameters this_ptr_conv;
41541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41542 this_ptr_conv.is_owned = false;
41543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41544 int32_t ret_val = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
41548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41549 LDKPaymentParameters this_ptr_conv;
41550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41551 this_ptr_conv.is_owned = false;
41552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41553 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
41556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int8_tArray payee_pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg) {
41557 LDKPublicKey payee_pubkey_arg_ref;
41558 CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
41559 (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
41560 LDKInvoiceFeatures features_arg_conv;
41561 features_arg_conv.inner = (void*)(features_arg & (~1));
41562 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
41563 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
41564 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
41565 LDKCVec_RouteHintZ route_hints_arg_constr;
41566 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
41567 if (route_hints_arg_constr.datalen > 0)
41568 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
41570 route_hints_arg_constr.data = NULL;
41571 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
41572 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
41573 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
41574 LDKRouteHint route_hints_arg_conv_11_conv;
41575 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
41576 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
41577 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
41578 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
41579 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
41581 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
41582 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
41583 CHECK_ACCESS(expiry_time_arg_ptr);
41584 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
41585 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
41586 LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg);
41587 uintptr_t ret_ref = 0;
41588 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41589 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41590 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41591 ret_ref = (uintptr_t)ret_var.inner;
41592 if (ret_var.is_owned) {
41598 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
41599 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
41600 uintptr_t ret_ref = 0;
41601 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41602 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41603 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41604 ret_ref = (uintptr_t)ret_var.inner;
41605 if (ret_var.is_owned) {
41610 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41611 LDKPaymentParameters arg_conv;
41612 arg_conv.inner = (void*)(arg & (~1));
41613 arg_conv.is_owned = false;
41614 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41615 intptr_t ret_val = PaymentParameters_clone_ptr(&arg_conv);
41619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41620 LDKPaymentParameters orig_conv;
41621 orig_conv.inner = (void*)(orig & (~1));
41622 orig_conv.is_owned = false;
41623 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41624 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
41625 uintptr_t ret_ref = 0;
41626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41629 ret_ref = (uintptr_t)ret_var.inner;
41630 if (ret_var.is_owned) {
41636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
41637 LDKPaymentParameters o_conv;
41638 o_conv.inner = (void*)(o & (~1));
41639 o_conv.is_owned = false;
41640 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41641 int64_t ret_val = PaymentParameters_hash(&o_conv);
41645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41646 LDKPaymentParameters a_conv;
41647 a_conv.inner = (void*)(a & (~1));
41648 a_conv.is_owned = false;
41649 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41650 LDKPaymentParameters b_conv;
41651 b_conv.inner = (void*)(b & (~1));
41652 b_conv.is_owned = false;
41653 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41654 jboolean ret_val = PaymentParameters_eq(&a_conv, &b_conv);
41658 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
41659 LDKPaymentParameters obj_conv;
41660 obj_conv.inner = (void*)(obj & (~1));
41661 obj_conv.is_owned = false;
41662 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41663 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
41664 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41665 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41666 CVec_u8Z_free(ret_var);
41670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41671 LDKu8slice ser_ref;
41672 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41673 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41674 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
41675 *ret_conv = PaymentParameters_read(ser_ref);
41676 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41677 return (uintptr_t)ret_conv;
41680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
41681 LDKPublicKey payee_pubkey_ref;
41682 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
41683 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
41684 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
41685 uintptr_t ret_ref = 0;
41686 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41687 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41688 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41689 ret_ref = (uintptr_t)ret_var.inner;
41690 if (ret_var.is_owned) {
41696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
41697 LDKPublicKey payee_pubkey_ref;
41698 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
41699 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
41700 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
41701 uintptr_t ret_ref = 0;
41702 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41703 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41704 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41705 ret_ref = (uintptr_t)ret_var.inner;
41706 if (ret_var.is_owned) {
41712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41713 LDKRouteHint this_obj_conv;
41714 this_obj_conv.inner = (void*)(this_obj & (~1));
41715 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41717 RouteHint_free(this_obj_conv);
41720 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
41721 LDKRouteHint this_ptr_conv;
41722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41723 this_ptr_conv.is_owned = false;
41724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41725 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
41726 int64_tArray ret_arr = NULL;
41727 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41728 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41729 for (size_t o = 0; o < ret_var.datalen; o++) {
41730 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
41731 uintptr_t ret_conv_14_ref = 0;
41732 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41733 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
41735 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
41736 if (ret_conv_14_var.is_owned) {
41737 ret_conv_14_ref |= 1;
41739 ret_arr_ptr[o] = ret_conv_14_ref;
41741 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41742 FREE(ret_var.data);
41746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
41747 LDKRouteHint this_ptr_conv;
41748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41749 this_ptr_conv.is_owned = false;
41750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41751 LDKCVec_RouteHintHopZ val_constr;
41752 val_constr.datalen = (*env)->GetArrayLength(env, val);
41753 if (val_constr.datalen > 0)
41754 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
41756 val_constr.data = NULL;
41757 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
41758 for (size_t o = 0; o < val_constr.datalen; o++) {
41759 int64_t val_conv_14 = val_vals[o];
41760 LDKRouteHintHop val_conv_14_conv;
41761 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
41762 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
41763 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
41764 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
41765 val_constr.data[o] = val_conv_14_conv;
41767 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
41768 RouteHint_set_a(&this_ptr_conv, val_constr);
41771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
41772 LDKCVec_RouteHintHopZ a_arg_constr;
41773 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
41774 if (a_arg_constr.datalen > 0)
41775 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
41777 a_arg_constr.data = NULL;
41778 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
41779 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
41780 int64_t a_arg_conv_14 = a_arg_vals[o];
41781 LDKRouteHintHop a_arg_conv_14_conv;
41782 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
41783 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
41784 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
41785 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
41786 a_arg_constr.data[o] = a_arg_conv_14_conv;
41788 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
41789 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
41790 uintptr_t ret_ref = 0;
41791 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41792 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41794 ret_ref = (uintptr_t)ret_var.inner;
41795 if (ret_var.is_owned) {
41801 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
41802 LDKRouteHint ret_var = RouteHint_clone(arg);
41803 uintptr_t ret_ref = 0;
41804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41807 ret_ref = (uintptr_t)ret_var.inner;
41808 if (ret_var.is_owned) {
41813 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41814 LDKRouteHint arg_conv;
41815 arg_conv.inner = (void*)(arg & (~1));
41816 arg_conv.is_owned = false;
41817 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41818 intptr_t ret_val = RouteHint_clone_ptr(&arg_conv);
41822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41823 LDKRouteHint orig_conv;
41824 orig_conv.inner = (void*)(orig & (~1));
41825 orig_conv.is_owned = false;
41826 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41827 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
41828 uintptr_t ret_ref = 0;
41829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41832 ret_ref = (uintptr_t)ret_var.inner;
41833 if (ret_var.is_owned) {
41839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
41840 LDKRouteHint o_conv;
41841 o_conv.inner = (void*)(o & (~1));
41842 o_conv.is_owned = false;
41843 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41844 int64_t ret_val = RouteHint_hash(&o_conv);
41848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41849 LDKRouteHint a_conv;
41850 a_conv.inner = (void*)(a & (~1));
41851 a_conv.is_owned = false;
41852 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41853 LDKRouteHint b_conv;
41854 b_conv.inner = (void*)(b & (~1));
41855 b_conv.is_owned = false;
41856 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41857 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
41861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
41862 LDKRouteHint obj_conv;
41863 obj_conv.inner = (void*)(obj & (~1));
41864 obj_conv.is_owned = false;
41865 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41866 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
41867 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41868 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41869 CVec_u8Z_free(ret_var);
41873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41874 LDKu8slice ser_ref;
41875 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41876 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41877 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
41878 *ret_conv = RouteHint_read(ser_ref);
41879 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41880 return (uintptr_t)ret_conv;
41883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41884 LDKRouteHintHop this_obj_conv;
41885 this_obj_conv.inner = (void*)(this_obj & (~1));
41886 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41888 RouteHintHop_free(this_obj_conv);
41891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41892 LDKRouteHintHop this_ptr_conv;
41893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41894 this_ptr_conv.is_owned = false;
41895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41896 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41897 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
41901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41902 LDKRouteHintHop this_ptr_conv;
41903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41904 this_ptr_conv.is_owned = false;
41905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41906 LDKPublicKey val_ref;
41907 CHECK((*env)->GetArrayLength(env, val) == 33);
41908 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41909 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
41912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41913 LDKRouteHintHop this_ptr_conv;
41914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41915 this_ptr_conv.is_owned = false;
41916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41917 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
41921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41922 LDKRouteHintHop this_ptr_conv;
41923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41924 this_ptr_conv.is_owned = false;
41925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41926 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
41929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
41930 LDKRouteHintHop this_ptr_conv;
41931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41932 this_ptr_conv.is_owned = false;
41933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41934 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
41935 uintptr_t ret_ref = 0;
41936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41939 ret_ref = (uintptr_t)ret_var.inner;
41940 if (ret_var.is_owned) {
41946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41947 LDKRouteHintHop this_ptr_conv;
41948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41949 this_ptr_conv.is_owned = false;
41950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41951 LDKRoutingFees val_conv;
41952 val_conv.inner = (void*)(val & (~1));
41953 val_conv.is_owned = (val & 1) || (val == 0);
41954 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41955 val_conv = RoutingFees_clone(&val_conv);
41956 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
41959 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41960 LDKRouteHintHop this_ptr_conv;
41961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41962 this_ptr_conv.is_owned = false;
41963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41964 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
41968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41969 LDKRouteHintHop this_ptr_conv;
41970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41971 this_ptr_conv.is_owned = false;
41972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41973 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
41976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41977 LDKRouteHintHop this_ptr_conv;
41978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41979 this_ptr_conv.is_owned = false;
41980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41981 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41982 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
41983 uintptr_t ret_ref = (uintptr_t)ret_copy;
41987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41988 LDKRouteHintHop this_ptr_conv;
41989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41990 this_ptr_conv.is_owned = false;
41991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41992 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41993 CHECK_ACCESS(val_ptr);
41994 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41995 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
41996 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
41999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42000 LDKRouteHintHop this_ptr_conv;
42001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42002 this_ptr_conv.is_owned = false;
42003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42004 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42005 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
42006 uintptr_t ret_ref = (uintptr_t)ret_copy;
42010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42011 LDKRouteHintHop this_ptr_conv;
42012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42013 this_ptr_conv.is_owned = false;
42014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42015 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42016 CHECK_ACCESS(val_ptr);
42017 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42018 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42019 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
42022 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) {
42023 LDKPublicKey src_node_id_arg_ref;
42024 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
42025 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
42026 LDKRoutingFees fees_arg_conv;
42027 fees_arg_conv.inner = (void*)(fees_arg & (~1));
42028 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
42029 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
42030 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
42031 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
42032 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
42033 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
42034 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
42035 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
42036 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
42037 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
42038 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
42039 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);
42040 uintptr_t ret_ref = 0;
42041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42044 ret_ref = (uintptr_t)ret_var.inner;
42045 if (ret_var.is_owned) {
42051 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
42052 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
42053 uintptr_t ret_ref = 0;
42054 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42055 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42056 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42057 ret_ref = (uintptr_t)ret_var.inner;
42058 if (ret_var.is_owned) {
42063 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42064 LDKRouteHintHop arg_conv;
42065 arg_conv.inner = (void*)(arg & (~1));
42066 arg_conv.is_owned = false;
42067 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42068 intptr_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
42072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42073 LDKRouteHintHop orig_conv;
42074 orig_conv.inner = (void*)(orig & (~1));
42075 orig_conv.is_owned = false;
42076 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42077 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
42078 uintptr_t ret_ref = 0;
42079 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42080 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42082 ret_ref = (uintptr_t)ret_var.inner;
42083 if (ret_var.is_owned) {
42089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
42090 LDKRouteHintHop o_conv;
42091 o_conv.inner = (void*)(o & (~1));
42092 o_conv.is_owned = false;
42093 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42094 int64_t ret_val = RouteHintHop_hash(&o_conv);
42098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42099 LDKRouteHintHop a_conv;
42100 a_conv.inner = (void*)(a & (~1));
42101 a_conv.is_owned = false;
42102 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42103 LDKRouteHintHop b_conv;
42104 b_conv.inner = (void*)(b & (~1));
42105 b_conv.is_owned = false;
42106 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42107 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
42111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
42112 LDKRouteHintHop obj_conv;
42113 obj_conv.inner = (void*)(obj & (~1));
42114 obj_conv.is_owned = false;
42115 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42116 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
42117 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42118 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42119 CVec_u8Z_free(ret_var);
42123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42124 LDKu8slice ser_ref;
42125 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42126 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42127 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
42128 *ret_conv = RouteHintHop_read(ser_ref);
42129 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42130 return (uintptr_t)ret_conv;
42133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) {
42134 LDKPublicKey our_node_pubkey_ref;
42135 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
42136 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
42137 LDKRouteParameters route_params_conv;
42138 route_params_conv.inner = (void*)(route_params & (~1));
42139 route_params_conv.is_owned = false;
42140 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42141 LDKNetworkGraph network_conv;
42142 network_conv.inner = (void*)(network & (~1));
42143 network_conv.is_owned = false;
42144 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
42145 LDKCVec_ChannelDetailsZ first_hops_constr;
42146 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
42147 if (first_hops != NULL) {
42148 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
42149 if (first_hops_constr.datalen > 0)
42150 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
42152 first_hops_constr.data = NULL;
42153 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
42154 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
42155 int64_t first_hops_conv_16 = first_hops_vals[q];
42156 LDKChannelDetails first_hops_conv_16_conv;
42157 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
42158 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
42159 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
42160 first_hops_constr.data[q] = first_hops_conv_16_conv;
42162 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
42163 first_hops_ptr = &first_hops_constr;
42165 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
42166 CHECK_ACCESS(logger_ptr);
42167 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42168 if (logger_conv.free == LDKLogger_JCalls_free) {
42169 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42170 LDKLogger_JCalls_cloned(&logger_conv);
42172 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
42173 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
42174 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
42175 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
42176 *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
42177 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
42178 return (uintptr_t)ret_conv;
42181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42182 if ((this_ptr & 1) != 0) return;
42183 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42184 CHECK_ACCESS(this_ptr_ptr);
42185 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
42186 FREE((void*)this_ptr);
42187 Score_free(this_ptr_conv);
42190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42191 if ((this_ptr & 1) != 0) return;
42192 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42193 CHECK_ACCESS(this_ptr_ptr);
42194 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
42195 FREE((void*)this_ptr);
42196 LockableScore_free(this_ptr_conv);
42199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42200 LDKMultiThreadedLockableScore this_obj_conv;
42201 this_obj_conv.inner = (void*)(this_obj & (~1));
42202 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42204 MultiThreadedLockableScore_free(this_obj_conv);
42207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
42208 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
42209 CHECK_ACCESS(score_ptr);
42210 LDKScore score_conv = *(LDKScore*)(score_ptr);
42211 if (score_conv.free == LDKScore_JCalls_free) {
42212 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42213 LDKScore_JCalls_cloned(&score_conv);
42215 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
42216 uintptr_t ret_ref = 0;
42217 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42218 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42220 ret_ref = (uintptr_t)ret_var.inner;
42221 if (ret_var.is_owned) {
42227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42228 LDKFixedPenaltyScorer this_obj_conv;
42229 this_obj_conv.inner = (void*)(this_obj & (~1));
42230 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42232 FixedPenaltyScorer_free(this_obj_conv);
42235 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
42236 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
42237 uintptr_t ret_ref = 0;
42238 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42239 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42241 ret_ref = (uintptr_t)ret_var.inner;
42242 if (ret_var.is_owned) {
42247 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42248 LDKFixedPenaltyScorer arg_conv;
42249 arg_conv.inner = (void*)(arg & (~1));
42250 arg_conv.is_owned = false;
42251 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42252 intptr_t ret_val = FixedPenaltyScorer_clone_ptr(&arg_conv);
42256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42257 LDKFixedPenaltyScorer orig_conv;
42258 orig_conv.inner = (void*)(orig & (~1));
42259 orig_conv.is_owned = false;
42260 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42261 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
42262 uintptr_t ret_ref = 0;
42263 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42264 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42266 ret_ref = (uintptr_t)ret_var.inner;
42267 if (ret_var.is_owned) {
42273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
42274 LDKFixedPenaltyScorer obj_conv;
42275 obj_conv.inner = (void*)(obj & (~1));
42276 obj_conv.is_owned = false;
42277 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42278 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
42279 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42280 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42281 CVec_u8Z_free(ret_var);
42285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42286 LDKu8slice ser_ref;
42287 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42288 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42289 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
42290 *ret_conv = FixedPenaltyScorer_read(ser_ref);
42291 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42292 return (uintptr_t)ret_conv;
42295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
42296 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
42297 uintptr_t ret_ref = 0;
42298 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42299 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42300 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42301 ret_ref = (uintptr_t)ret_var.inner;
42302 if (ret_var.is_owned) {
42308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
42309 LDKFixedPenaltyScorer this_arg_conv;
42310 this_arg_conv.inner = (void*)(this_arg & (~1));
42311 this_arg_conv.is_owned = false;
42312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42313 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42314 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
42315 return (uintptr_t)ret_ret;
42318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42319 LDKScorer this_obj_conv;
42320 this_obj_conv.inner = (void*)(this_obj & (~1));
42321 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42323 Scorer_free(this_obj_conv);
42326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42327 LDKScoringParameters this_obj_conv;
42328 this_obj_conv.inner = (void*)(this_obj & (~1));
42329 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42331 ScoringParameters_free(this_obj_conv);
42334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42335 LDKScoringParameters this_ptr_conv;
42336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42337 this_ptr_conv.is_owned = false;
42338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42339 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
42343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42344 LDKScoringParameters this_ptr_conv;
42345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42346 this_ptr_conv.is_owned = false;
42347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42348 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
42351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42352 LDKScoringParameters this_ptr_conv;
42353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42354 this_ptr_conv.is_owned = false;
42355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42356 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
42360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42361 LDKScoringParameters this_ptr_conv;
42362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42363 this_ptr_conv.is_owned = false;
42364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42365 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
42368 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
42369 LDKScoringParameters this_ptr_conv;
42370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42371 this_ptr_conv.is_owned = false;
42372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42373 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
42377 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) {
42378 LDKScoringParameters this_ptr_conv;
42379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42380 this_ptr_conv.is_owned = false;
42381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42382 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
42385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
42386 LDKScoringParameters this_ptr_conv;
42387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42388 this_ptr_conv.is_owned = false;
42389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42390 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
42394 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) {
42395 LDKScoringParameters this_ptr_conv;
42396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42397 this_ptr_conv.is_owned = false;
42398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42399 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
42402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
42403 LDKScoringParameters this_ptr_conv;
42404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42405 this_ptr_conv.is_owned = false;
42406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42407 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
42411 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) {
42412 LDKScoringParameters this_ptr_conv;
42413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42414 this_ptr_conv.is_owned = false;
42415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42416 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
42419 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) {
42420 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);
42421 uintptr_t ret_ref = 0;
42422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42425 ret_ref = (uintptr_t)ret_var.inner;
42426 if (ret_var.is_owned) {
42432 static inline uintptr_t ScoringParameters_clone_ptr(LDKScoringParameters *NONNULL_PTR arg) {
42433 LDKScoringParameters ret_var = ScoringParameters_clone(arg);
42434 uintptr_t ret_ref = 0;
42435 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42436 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42438 ret_ref = (uintptr_t)ret_var.inner;
42439 if (ret_var.is_owned) {
42444 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42445 LDKScoringParameters arg_conv;
42446 arg_conv.inner = (void*)(arg & (~1));
42447 arg_conv.is_owned = false;
42448 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42449 intptr_t ret_val = ScoringParameters_clone_ptr(&arg_conv);
42453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42454 LDKScoringParameters orig_conv;
42455 orig_conv.inner = (void*)(orig & (~1));
42456 orig_conv.is_owned = false;
42457 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42458 LDKScoringParameters ret_var = ScoringParameters_clone(&orig_conv);
42459 uintptr_t ret_ref = 0;
42460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42463 ret_ref = (uintptr_t)ret_var.inner;
42464 if (ret_var.is_owned) {
42470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
42471 LDKScoringParameters obj_conv;
42472 obj_conv.inner = (void*)(obj & (~1));
42473 obj_conv.is_owned = false;
42474 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42475 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
42476 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42477 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42478 CVec_u8Z_free(ret_var);
42482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42483 LDKu8slice ser_ref;
42484 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42485 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42486 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
42487 *ret_conv = ScoringParameters_read(ser_ref);
42488 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42489 return (uintptr_t)ret_conv;
42492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t params) {
42493 LDKScoringParameters params_conv;
42494 params_conv.inner = (void*)(params & (~1));
42495 params_conv.is_owned = (params & 1) || (params == 0);
42496 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
42497 params_conv = ScoringParameters_clone(¶ms_conv);
42498 LDKScorer ret_var = Scorer_new(params_conv);
42499 uintptr_t ret_ref = 0;
42500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42503 ret_ref = (uintptr_t)ret_var.inner;
42504 if (ret_var.is_owned) {
42510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) {
42511 LDKScorer ret_var = Scorer_default();
42512 uintptr_t ret_ref = 0;
42513 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42514 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42515 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42516 ret_ref = (uintptr_t)ret_var.inner;
42517 if (ret_var.is_owned) {
42523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1default(JNIEnv *env, jclass clz) {
42524 LDKScoringParameters ret_var = ScoringParameters_default();
42525 uintptr_t ret_ref = 0;
42526 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42527 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42528 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42529 ret_ref = (uintptr_t)ret_var.inner;
42530 if (ret_var.is_owned) {
42536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
42537 LDKScorer this_arg_conv;
42538 this_arg_conv.inner = (void*)(this_arg & (~1));
42539 this_arg_conv.is_owned = false;
42540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42541 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42542 *ret_ret = Scorer_as_Score(&this_arg_conv);
42543 return (uintptr_t)ret_ret;
42546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Scorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
42547 LDKScorer obj_conv;
42548 obj_conv.inner = (void*)(obj & (~1));
42549 obj_conv.is_owned = false;
42550 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42551 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
42552 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42553 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42554 CVec_u8Z_free(ret_var);
42558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42559 LDKu8slice ser_ref;
42560 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42561 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42562 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
42563 *ret_conv = Scorer_read(ser_ref);
42564 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42565 return (uintptr_t)ret_conv;
42568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42569 LDKProbabilisticScoringParameters this_obj_conv;
42570 this_obj_conv.inner = (void*)(this_obj & (~1));
42571 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42573 ProbabilisticScoringParameters_free(this_obj_conv);
42576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42577 LDKProbabilisticScoringParameters this_ptr_conv;
42578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42579 this_ptr_conv.is_owned = false;
42580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42581 int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
42585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42586 LDKProbabilisticScoringParameters this_ptr_conv;
42587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42588 this_ptr_conv.is_owned = false;
42589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42590 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
42593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
42594 LDKProbabilisticScoringParameters this_ptr_conv;
42595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42596 this_ptr_conv.is_owned = false;
42597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42598 int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
42602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42603 LDKProbabilisticScoringParameters this_ptr_conv;
42604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42605 this_ptr_conv.is_owned = false;
42606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42607 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
42610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg) {
42611 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg);
42612 uintptr_t ret_ref = 0;
42613 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42614 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42616 ret_ref = (uintptr_t)ret_var.inner;
42617 if (ret_var.is_owned) {
42623 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
42624 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
42625 uintptr_t ret_ref = 0;
42626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42629 ret_ref = (uintptr_t)ret_var.inner;
42630 if (ret_var.is_owned) {
42635 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42636 LDKProbabilisticScoringParameters arg_conv;
42637 arg_conv.inner = (void*)(arg & (~1));
42638 arg_conv.is_owned = false;
42639 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42640 intptr_t ret_val = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
42644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42645 LDKProbabilisticScoringParameters orig_conv;
42646 orig_conv.inner = (void*)(orig & (~1));
42647 orig_conv.is_owned = false;
42648 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42649 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
42650 uintptr_t ret_ref = 0;
42651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42654 ret_ref = (uintptr_t)ret_var.inner;
42655 if (ret_var.is_owned) {
42661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
42662 LDKProbabilisticScoringParameters obj_conv;
42663 obj_conv.inner = (void*)(obj & (~1));
42664 obj_conv.is_owned = false;
42665 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42666 LDKCVec_u8Z ret_var = ProbabilisticScoringParameters_write(&obj_conv);
42667 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42668 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42669 CVec_u8Z_free(ret_var);
42673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42674 LDKu8slice ser_ref;
42675 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42676 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42677 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
42678 *ret_conv = ProbabilisticScoringParameters_read(ser_ref);
42679 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42680 return (uintptr_t)ret_conv;
42683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
42684 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
42685 uintptr_t ret_ref = 0;
42686 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42687 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42688 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42689 ret_ref = (uintptr_t)ret_var.inner;
42690 if (ret_var.is_owned) {
42696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42697 LDKFilesystemPersister this_obj_conv;
42698 this_obj_conv.inner = (void*)(this_obj & (~1));
42699 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42701 FilesystemPersister_free(this_obj_conv);
42704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
42705 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
42706 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
42707 uintptr_t ret_ref = 0;
42708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42711 ret_ref = (uintptr_t)ret_var.inner;
42712 if (ret_var.is_owned) {
42718 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
42719 LDKFilesystemPersister this_arg_conv;
42720 this_arg_conv.inner = (void*)(this_arg & (~1));
42721 this_arg_conv.is_owned = false;
42722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42723 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
42724 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
42730 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
42731 LDKChannelManager manager_conv;
42732 manager_conv.inner = (void*)(manager & (~1));
42733 manager_conv.is_owned = false;
42734 CHECK_INNER_FIELD_ACCESS_OR_NULL(manager_conv);
42735 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
42736 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
42737 return (uintptr_t)ret_conv;
42740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
42741 LDKFilesystemPersister this_arg_conv;
42742 this_arg_conv.inner = (void*)(this_arg & (~1));
42743 this_arg_conv.is_owned = false;
42744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42745 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
42746 CHECK_ACCESS(keys_manager_ptr);
42747 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
42748 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
42749 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42750 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
42752 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
42753 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
42754 return (uintptr_t)ret_conv;
42757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
42758 LDKFilesystemPersister this_arg_conv;
42759 this_arg_conv.inner = (void*)(this_arg & (~1));
42760 this_arg_conv.is_owned = false;
42761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42762 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
42763 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
42764 return (uintptr_t)ret_ret;
42767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42768 LDKBackgroundProcessor this_obj_conv;
42769 this_obj_conv.inner = (void*)(this_obj & (~1));
42770 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42772 BackgroundProcessor_free(this_obj_conv);
42775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42776 if ((this_ptr & 1) != 0) return;
42777 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42778 CHECK_ACCESS(this_ptr_ptr);
42779 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
42780 FREE((void*)this_ptr);
42781 ChannelManagerPersister_free(this_ptr_conv);
42784 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) {
42785 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
42786 CHECK_ACCESS(persister_ptr);
42787 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
42788 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
42789 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42790 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
42792 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
42793 CHECK_ACCESS(event_handler_ptr);
42794 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
42795 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
42796 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42797 LDKEventHandler_JCalls_cloned(&event_handler_conv);
42799 LDKChainMonitor chain_monitor_conv;
42800 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
42801 chain_monitor_conv.is_owned = false;
42802 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
42803 LDKChannelManager channel_manager_conv;
42804 channel_manager_conv.inner = (void*)(channel_manager & (~1));
42805 channel_manager_conv.is_owned = false;
42806 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
42807 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
42808 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
42809 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
42810 CHECK_INNER_FIELD_ACCESS_OR_NULL(net_graph_msg_handler_conv);
42811 LDKPeerManager peer_manager_conv;
42812 peer_manager_conv.inner = (void*)(peer_manager & (~1));
42813 peer_manager_conv.is_owned = false;
42814 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
42815 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
42816 CHECK_ACCESS(logger_ptr);
42817 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42818 if (logger_conv.free == LDKLogger_JCalls_free) {
42819 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42820 LDKLogger_JCalls_cloned(&logger_conv);
42822 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);
42823 uintptr_t ret_ref = 0;
42824 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42825 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42826 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42827 ret_ref = (uintptr_t)ret_var.inner;
42828 if (ret_var.is_owned) {
42834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
42835 LDKBackgroundProcessor this_arg_conv;
42836 this_arg_conv.inner = (void*)(this_arg & (~1));
42837 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
42838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42839 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
42840 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
42841 *ret_conv = BackgroundProcessor_join(this_arg_conv);
42842 return (uintptr_t)ret_conv;
42845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
42846 LDKBackgroundProcessor this_arg_conv;
42847 this_arg_conv.inner = (void*)(this_arg & (~1));
42848 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
42849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42850 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
42851 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
42852 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
42853 return (uintptr_t)ret_conv;
42856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42857 LDKInvoice this_obj_conv;
42858 this_obj_conv.inner = (void*)(this_obj & (~1));
42859 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42861 Invoice_free(this_obj_conv);
42864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42866 a_conv.inner = (void*)(a & (~1));
42867 a_conv.is_owned = false;
42868 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42870 b_conv.inner = (void*)(b & (~1));
42871 b_conv.is_owned = false;
42872 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42873 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
42877 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
42878 LDKInvoice ret_var = Invoice_clone(arg);
42879 uintptr_t ret_ref = 0;
42880 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42881 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42882 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42883 ret_ref = (uintptr_t)ret_var.inner;
42884 if (ret_var.is_owned) {
42889 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42890 LDKInvoice arg_conv;
42891 arg_conv.inner = (void*)(arg & (~1));
42892 arg_conv.is_owned = false;
42893 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42894 intptr_t ret_val = Invoice_clone_ptr(&arg_conv);
42898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42899 LDKInvoice orig_conv;
42900 orig_conv.inner = (void*)(orig & (~1));
42901 orig_conv.is_owned = false;
42902 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42903 LDKInvoice ret_var = Invoice_clone(&orig_conv);
42904 uintptr_t ret_ref = 0;
42905 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42906 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42908 ret_ref = (uintptr_t)ret_var.inner;
42909 if (ret_var.is_owned) {
42915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42916 LDKSignedRawInvoice this_obj_conv;
42917 this_obj_conv.inner = (void*)(this_obj & (~1));
42918 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42920 SignedRawInvoice_free(this_obj_conv);
42923 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42924 LDKSignedRawInvoice a_conv;
42925 a_conv.inner = (void*)(a & (~1));
42926 a_conv.is_owned = false;
42927 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42928 LDKSignedRawInvoice b_conv;
42929 b_conv.inner = (void*)(b & (~1));
42930 b_conv.is_owned = false;
42931 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42932 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
42936 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
42937 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
42938 uintptr_t ret_ref = 0;
42939 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42940 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42942 ret_ref = (uintptr_t)ret_var.inner;
42943 if (ret_var.is_owned) {
42948 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42949 LDKSignedRawInvoice arg_conv;
42950 arg_conv.inner = (void*)(arg & (~1));
42951 arg_conv.is_owned = false;
42952 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42953 intptr_t ret_val = SignedRawInvoice_clone_ptr(&arg_conv);
42957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42958 LDKSignedRawInvoice orig_conv;
42959 orig_conv.inner = (void*)(orig & (~1));
42960 orig_conv.is_owned = false;
42961 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42962 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
42963 uintptr_t ret_ref = 0;
42964 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42965 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42967 ret_ref = (uintptr_t)ret_var.inner;
42968 if (ret_var.is_owned) {
42974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42975 LDKRawInvoice this_obj_conv;
42976 this_obj_conv.inner = (void*)(this_obj & (~1));
42977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42979 RawInvoice_free(this_obj_conv);
42982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
42983 LDKRawInvoice this_ptr_conv;
42984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42985 this_ptr_conv.is_owned = false;
42986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42987 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
42988 uintptr_t ret_ref = 0;
42989 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42990 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42992 ret_ref = (uintptr_t)ret_var.inner;
42993 if (ret_var.is_owned) {
42999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43000 LDKRawInvoice this_ptr_conv;
43001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43002 this_ptr_conv.is_owned = false;
43003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43004 LDKRawDataPart val_conv;
43005 val_conv.inner = (void*)(val & (~1));
43006 val_conv.is_owned = (val & 1) || (val == 0);
43007 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43008 val_conv = RawDataPart_clone(&val_conv);
43009 RawInvoice_set_data(&this_ptr_conv, val_conv);
43012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43013 LDKRawInvoice a_conv;
43014 a_conv.inner = (void*)(a & (~1));
43015 a_conv.is_owned = false;
43016 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43017 LDKRawInvoice b_conv;
43018 b_conv.inner = (void*)(b & (~1));
43019 b_conv.is_owned = false;
43020 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43021 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
43025 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
43026 LDKRawInvoice ret_var = RawInvoice_clone(arg);
43027 uintptr_t ret_ref = 0;
43028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43031 ret_ref = (uintptr_t)ret_var.inner;
43032 if (ret_var.is_owned) {
43037 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43038 LDKRawInvoice arg_conv;
43039 arg_conv.inner = (void*)(arg & (~1));
43040 arg_conv.is_owned = false;
43041 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43042 intptr_t ret_val = RawInvoice_clone_ptr(&arg_conv);
43046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43047 LDKRawInvoice orig_conv;
43048 orig_conv.inner = (void*)(orig & (~1));
43049 orig_conv.is_owned = false;
43050 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43051 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
43052 uintptr_t ret_ref = 0;
43053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43056 ret_ref = (uintptr_t)ret_var.inner;
43057 if (ret_var.is_owned) {
43063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43064 LDKRawDataPart this_obj_conv;
43065 this_obj_conv.inner = (void*)(this_obj & (~1));
43066 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43068 RawDataPart_free(this_obj_conv);
43071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
43072 LDKRawDataPart this_ptr_conv;
43073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43074 this_ptr_conv.is_owned = false;
43075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43076 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
43077 uintptr_t ret_ref = 0;
43078 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43079 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43081 ret_ref = (uintptr_t)ret_var.inner;
43082 if (ret_var.is_owned) {
43088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43089 LDKRawDataPart this_ptr_conv;
43090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43091 this_ptr_conv.is_owned = false;
43092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43093 LDKPositiveTimestamp val_conv;
43094 val_conv.inner = (void*)(val & (~1));
43095 val_conv.is_owned = (val & 1) || (val == 0);
43096 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43097 val_conv = PositiveTimestamp_clone(&val_conv);
43098 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
43101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43102 LDKRawDataPart a_conv;
43103 a_conv.inner = (void*)(a & (~1));
43104 a_conv.is_owned = false;
43105 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43106 LDKRawDataPart b_conv;
43107 b_conv.inner = (void*)(b & (~1));
43108 b_conv.is_owned = false;
43109 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43110 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
43114 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
43115 LDKRawDataPart ret_var = RawDataPart_clone(arg);
43116 uintptr_t ret_ref = 0;
43117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43120 ret_ref = (uintptr_t)ret_var.inner;
43121 if (ret_var.is_owned) {
43126 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43127 LDKRawDataPart arg_conv;
43128 arg_conv.inner = (void*)(arg & (~1));
43129 arg_conv.is_owned = false;
43130 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43131 intptr_t ret_val = RawDataPart_clone_ptr(&arg_conv);
43135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43136 LDKRawDataPart orig_conv;
43137 orig_conv.inner = (void*)(orig & (~1));
43138 orig_conv.is_owned = false;
43139 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43140 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
43141 uintptr_t ret_ref = 0;
43142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43145 ret_ref = (uintptr_t)ret_var.inner;
43146 if (ret_var.is_owned) {
43152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43153 LDKPositiveTimestamp this_obj_conv;
43154 this_obj_conv.inner = (void*)(this_obj & (~1));
43155 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43157 PositiveTimestamp_free(this_obj_conv);
43160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43161 LDKPositiveTimestamp a_conv;
43162 a_conv.inner = (void*)(a & (~1));
43163 a_conv.is_owned = false;
43164 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43165 LDKPositiveTimestamp b_conv;
43166 b_conv.inner = (void*)(b & (~1));
43167 b_conv.is_owned = false;
43168 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43169 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
43173 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
43174 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
43175 uintptr_t ret_ref = 0;
43176 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43177 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43179 ret_ref = (uintptr_t)ret_var.inner;
43180 if (ret_var.is_owned) {
43185 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43186 LDKPositiveTimestamp arg_conv;
43187 arg_conv.inner = (void*)(arg & (~1));
43188 arg_conv.is_owned = false;
43189 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43190 intptr_t ret_val = PositiveTimestamp_clone_ptr(&arg_conv);
43194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43195 LDKPositiveTimestamp orig_conv;
43196 orig_conv.inner = (void*)(orig & (~1));
43197 orig_conv.is_owned = false;
43198 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43199 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
43200 uintptr_t ret_ref = 0;
43201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43204 ret_ref = (uintptr_t)ret_var.inner;
43205 if (ret_var.is_owned) {
43211 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43212 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
43213 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
43217 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
43218 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
43222 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
43223 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
43227 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
43228 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
43232 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
43233 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
43237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43238 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
43239 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
43240 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
43244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
43245 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
43246 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
43250 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43251 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
43252 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
43256 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
43257 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
43261 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
43262 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
43266 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
43267 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
43271 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
43272 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
43276 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
43277 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
43281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
43282 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
43283 int64_t ret_val = Currency_hash(o_conv);
43287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43288 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
43289 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
43290 jboolean ret_val = Currency_eq(a_conv, b_conv);
43294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43295 LDKSha256 this_obj_conv;
43296 this_obj_conv.inner = (void*)(this_obj & (~1));
43297 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43299 Sha256_free(this_obj_conv);
43302 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
43303 LDKSha256 ret_var = Sha256_clone(arg);
43304 uintptr_t ret_ref = 0;
43305 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43306 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43308 ret_ref = (uintptr_t)ret_var.inner;
43309 if (ret_var.is_owned) {
43314 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43315 LDKSha256 arg_conv;
43316 arg_conv.inner = (void*)(arg & (~1));
43317 arg_conv.is_owned = false;
43318 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43319 intptr_t ret_val = Sha256_clone_ptr(&arg_conv);
43323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43324 LDKSha256 orig_conv;
43325 orig_conv.inner = (void*)(orig & (~1));
43326 orig_conv.is_owned = false;
43327 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43328 LDKSha256 ret_var = Sha256_clone(&orig_conv);
43329 uintptr_t ret_ref = 0;
43330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43333 ret_ref = (uintptr_t)ret_var.inner;
43334 if (ret_var.is_owned) {
43340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
43342 o_conv.inner = (void*)(o & (~1));
43343 o_conv.is_owned = false;
43344 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43345 int64_t ret_val = Sha256_hash(&o_conv);
43349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43351 a_conv.inner = (void*)(a & (~1));
43352 a_conv.is_owned = false;
43353 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43355 b_conv.inner = (void*)(b & (~1));
43356 b_conv.is_owned = false;
43357 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43358 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
43362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43363 LDKDescription this_obj_conv;
43364 this_obj_conv.inner = (void*)(this_obj & (~1));
43365 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43367 Description_free(this_obj_conv);
43370 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
43371 LDKDescription ret_var = Description_clone(arg);
43372 uintptr_t ret_ref = 0;
43373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43376 ret_ref = (uintptr_t)ret_var.inner;
43377 if (ret_var.is_owned) {
43382 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43383 LDKDescription arg_conv;
43384 arg_conv.inner = (void*)(arg & (~1));
43385 arg_conv.is_owned = false;
43386 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43387 intptr_t ret_val = Description_clone_ptr(&arg_conv);
43391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43392 LDKDescription orig_conv;
43393 orig_conv.inner = (void*)(orig & (~1));
43394 orig_conv.is_owned = false;
43395 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43396 LDKDescription ret_var = Description_clone(&orig_conv);
43397 uintptr_t ret_ref = 0;
43398 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43399 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43401 ret_ref = (uintptr_t)ret_var.inner;
43402 if (ret_var.is_owned) {
43408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
43409 LDKDescription o_conv;
43410 o_conv.inner = (void*)(o & (~1));
43411 o_conv.is_owned = false;
43412 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43413 int64_t ret_val = Description_hash(&o_conv);
43417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43418 LDKDescription a_conv;
43419 a_conv.inner = (void*)(a & (~1));
43420 a_conv.is_owned = false;
43421 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43422 LDKDescription b_conv;
43423 b_conv.inner = (void*)(b & (~1));
43424 b_conv.is_owned = false;
43425 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43426 jboolean ret_val = Description_eq(&a_conv, &b_conv);
43430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43431 LDKPayeePubKey this_obj_conv;
43432 this_obj_conv.inner = (void*)(this_obj & (~1));
43433 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43435 PayeePubKey_free(this_obj_conv);
43438 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
43439 LDKPayeePubKey this_ptr_conv;
43440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43441 this_ptr_conv.is_owned = false;
43442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43443 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43444 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
43448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43449 LDKPayeePubKey this_ptr_conv;
43450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43451 this_ptr_conv.is_owned = false;
43452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43453 LDKPublicKey val_ref;
43454 CHECK((*env)->GetArrayLength(env, val) == 33);
43455 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43456 PayeePubKey_set_a(&this_ptr_conv, val_ref);
43459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
43460 LDKPublicKey a_arg_ref;
43461 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
43462 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
43463 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
43464 uintptr_t ret_ref = 0;
43465 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43466 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43468 ret_ref = (uintptr_t)ret_var.inner;
43469 if (ret_var.is_owned) {
43475 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
43476 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
43477 uintptr_t ret_ref = 0;
43478 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43479 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43480 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43481 ret_ref = (uintptr_t)ret_var.inner;
43482 if (ret_var.is_owned) {
43487 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43488 LDKPayeePubKey arg_conv;
43489 arg_conv.inner = (void*)(arg & (~1));
43490 arg_conv.is_owned = false;
43491 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43492 intptr_t ret_val = PayeePubKey_clone_ptr(&arg_conv);
43496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43497 LDKPayeePubKey orig_conv;
43498 orig_conv.inner = (void*)(orig & (~1));
43499 orig_conv.is_owned = false;
43500 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43501 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
43502 uintptr_t ret_ref = 0;
43503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43506 ret_ref = (uintptr_t)ret_var.inner;
43507 if (ret_var.is_owned) {
43513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
43514 LDKPayeePubKey o_conv;
43515 o_conv.inner = (void*)(o & (~1));
43516 o_conv.is_owned = false;
43517 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43518 int64_t ret_val = PayeePubKey_hash(&o_conv);
43522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43523 LDKPayeePubKey a_conv;
43524 a_conv.inner = (void*)(a & (~1));
43525 a_conv.is_owned = false;
43526 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43527 LDKPayeePubKey b_conv;
43528 b_conv.inner = (void*)(b & (~1));
43529 b_conv.is_owned = false;
43530 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43531 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
43535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43536 LDKExpiryTime this_obj_conv;
43537 this_obj_conv.inner = (void*)(this_obj & (~1));
43538 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43540 ExpiryTime_free(this_obj_conv);
43543 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
43544 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
43545 uintptr_t ret_ref = 0;
43546 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43547 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43549 ret_ref = (uintptr_t)ret_var.inner;
43550 if (ret_var.is_owned) {
43555 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43556 LDKExpiryTime arg_conv;
43557 arg_conv.inner = (void*)(arg & (~1));
43558 arg_conv.is_owned = false;
43559 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43560 intptr_t ret_val = ExpiryTime_clone_ptr(&arg_conv);
43564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43565 LDKExpiryTime orig_conv;
43566 orig_conv.inner = (void*)(orig & (~1));
43567 orig_conv.is_owned = false;
43568 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43569 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
43570 uintptr_t ret_ref = 0;
43571 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43572 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43573 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43574 ret_ref = (uintptr_t)ret_var.inner;
43575 if (ret_var.is_owned) {
43581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
43582 LDKExpiryTime o_conv;
43583 o_conv.inner = (void*)(o & (~1));
43584 o_conv.is_owned = false;
43585 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43586 int64_t ret_val = ExpiryTime_hash(&o_conv);
43590 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43591 LDKExpiryTime a_conv;
43592 a_conv.inner = (void*)(a & (~1));
43593 a_conv.is_owned = false;
43594 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43595 LDKExpiryTime b_conv;
43596 b_conv.inner = (void*)(b & (~1));
43597 b_conv.is_owned = false;
43598 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43599 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
43603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43604 LDKMinFinalCltvExpiry this_obj_conv;
43605 this_obj_conv.inner = (void*)(this_obj & (~1));
43606 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43608 MinFinalCltvExpiry_free(this_obj_conv);
43611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
43612 LDKMinFinalCltvExpiry this_ptr_conv;
43613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43614 this_ptr_conv.is_owned = false;
43615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43616 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
43620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43621 LDKMinFinalCltvExpiry this_ptr_conv;
43622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43623 this_ptr_conv.is_owned = false;
43624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43625 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
43628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
43629 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
43630 uintptr_t ret_ref = 0;
43631 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43632 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43634 ret_ref = (uintptr_t)ret_var.inner;
43635 if (ret_var.is_owned) {
43641 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
43642 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
43643 uintptr_t ret_ref = 0;
43644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43647 ret_ref = (uintptr_t)ret_var.inner;
43648 if (ret_var.is_owned) {
43653 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43654 LDKMinFinalCltvExpiry arg_conv;
43655 arg_conv.inner = (void*)(arg & (~1));
43656 arg_conv.is_owned = false;
43657 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43658 intptr_t ret_val = MinFinalCltvExpiry_clone_ptr(&arg_conv);
43662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43663 LDKMinFinalCltvExpiry orig_conv;
43664 orig_conv.inner = (void*)(orig & (~1));
43665 orig_conv.is_owned = false;
43666 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43667 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
43668 uintptr_t ret_ref = 0;
43669 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43670 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43671 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43672 ret_ref = (uintptr_t)ret_var.inner;
43673 if (ret_var.is_owned) {
43679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
43680 LDKMinFinalCltvExpiry o_conv;
43681 o_conv.inner = (void*)(o & (~1));
43682 o_conv.is_owned = false;
43683 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43684 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
43688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43689 LDKMinFinalCltvExpiry a_conv;
43690 a_conv.inner = (void*)(a & (~1));
43691 a_conv.is_owned = false;
43692 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43693 LDKMinFinalCltvExpiry b_conv;
43694 b_conv.inner = (void*)(b & (~1));
43695 b_conv.is_owned = false;
43696 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43697 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
43701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43702 if ((this_ptr & 1) != 0) return;
43703 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43704 CHECK_ACCESS(this_ptr_ptr);
43705 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
43706 FREE((void*)this_ptr);
43707 Fallback_free(this_ptr_conv);
43710 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
43711 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
43712 *ret_copy = Fallback_clone(arg);
43713 uintptr_t ret_ref = (uintptr_t)ret_copy;
43716 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43717 LDKFallback* arg_conv = (LDKFallback*)arg;
43718 intptr_t ret_val = Fallback_clone_ptr(arg_conv);
43722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43723 LDKFallback* orig_conv = (LDKFallback*)orig;
43724 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
43725 *ret_copy = Fallback_clone(orig_conv);
43726 uintptr_t ret_ref = (uintptr_t)ret_copy;
43730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
43732 LDKCVec_u8Z program_ref;
43733 program_ref.datalen = (*env)->GetArrayLength(env, program);
43734 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
43735 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
43736 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
43737 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
43738 uintptr_t ret_ref = (uintptr_t)ret_copy;
43742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
43743 LDKTwentyBytes a_ref;
43744 CHECK((*env)->GetArrayLength(env, a) == 20);
43745 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
43746 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
43747 *ret_copy = Fallback_pub_key_hash(a_ref);
43748 uintptr_t ret_ref = (uintptr_t)ret_copy;
43752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
43753 LDKTwentyBytes a_ref;
43754 CHECK((*env)->GetArrayLength(env, a) == 20);
43755 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
43756 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
43757 *ret_copy = Fallback_script_hash(a_ref);
43758 uintptr_t ret_ref = (uintptr_t)ret_copy;
43762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
43763 LDKFallback* o_conv = (LDKFallback*)o;
43764 int64_t ret_val = Fallback_hash(o_conv);
43768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43769 LDKFallback* a_conv = (LDKFallback*)a;
43770 LDKFallback* b_conv = (LDKFallback*)b;
43771 jboolean ret_val = Fallback_eq(a_conv, b_conv);
43775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43776 LDKInvoiceSignature this_obj_conv;
43777 this_obj_conv.inner = (void*)(this_obj & (~1));
43778 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43780 InvoiceSignature_free(this_obj_conv);
43783 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
43784 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
43785 uintptr_t ret_ref = 0;
43786 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43787 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43789 ret_ref = (uintptr_t)ret_var.inner;
43790 if (ret_var.is_owned) {
43795 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43796 LDKInvoiceSignature arg_conv;
43797 arg_conv.inner = (void*)(arg & (~1));
43798 arg_conv.is_owned = false;
43799 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43800 intptr_t ret_val = InvoiceSignature_clone_ptr(&arg_conv);
43804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43805 LDKInvoiceSignature orig_conv;
43806 orig_conv.inner = (void*)(orig & (~1));
43807 orig_conv.is_owned = false;
43808 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43809 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
43810 uintptr_t ret_ref = 0;
43811 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43812 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43814 ret_ref = (uintptr_t)ret_var.inner;
43815 if (ret_var.is_owned) {
43821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43822 LDKInvoiceSignature a_conv;
43823 a_conv.inner = (void*)(a & (~1));
43824 a_conv.is_owned = false;
43825 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43826 LDKInvoiceSignature b_conv;
43827 b_conv.inner = (void*)(b & (~1));
43828 b_conv.is_owned = false;
43829 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43830 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
43834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43835 LDKPrivateRoute this_obj_conv;
43836 this_obj_conv.inner = (void*)(this_obj & (~1));
43837 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43839 PrivateRoute_free(this_obj_conv);
43842 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
43843 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
43844 uintptr_t ret_ref = 0;
43845 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43846 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43848 ret_ref = (uintptr_t)ret_var.inner;
43849 if (ret_var.is_owned) {
43854 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43855 LDKPrivateRoute arg_conv;
43856 arg_conv.inner = (void*)(arg & (~1));
43857 arg_conv.is_owned = false;
43858 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43859 intptr_t ret_val = PrivateRoute_clone_ptr(&arg_conv);
43863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43864 LDKPrivateRoute orig_conv;
43865 orig_conv.inner = (void*)(orig & (~1));
43866 orig_conv.is_owned = false;
43867 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43868 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
43869 uintptr_t ret_ref = 0;
43870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43873 ret_ref = (uintptr_t)ret_var.inner;
43874 if (ret_var.is_owned) {
43880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
43881 LDKPrivateRoute o_conv;
43882 o_conv.inner = (void*)(o & (~1));
43883 o_conv.is_owned = false;
43884 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43885 int64_t ret_val = PrivateRoute_hash(&o_conv);
43889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43890 LDKPrivateRoute a_conv;
43891 a_conv.inner = (void*)(a & (~1));
43892 a_conv.is_owned = false;
43893 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43894 LDKPrivateRoute b_conv;
43895 b_conv.inner = (void*)(b & (~1));
43896 b_conv.is_owned = false;
43897 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43898 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
43902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
43903 LDKSignedRawInvoice this_arg_conv;
43904 this_arg_conv.inner = (void*)(this_arg & (~1));
43905 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43907 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
43908 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
43909 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
43910 return ((uintptr_t)ret_conv);
43913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
43914 LDKSignedRawInvoice this_arg_conv;
43915 this_arg_conv.inner = (void*)(this_arg & (~1));
43916 this_arg_conv.is_owned = false;
43917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43918 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
43919 uintptr_t ret_ref = 0;
43920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43923 ret_ref = (uintptr_t)ret_var.inner;
43924 if (ret_var.is_owned) {
43930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
43931 LDKSignedRawInvoice this_arg_conv;
43932 this_arg_conv.inner = (void*)(this_arg & (~1));
43933 this_arg_conv.is_owned = false;
43934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43935 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43936 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
43940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
43941 LDKSignedRawInvoice this_arg_conv;
43942 this_arg_conv.inner = (void*)(this_arg & (~1));
43943 this_arg_conv.is_owned = false;
43944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43945 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
43946 uintptr_t ret_ref = 0;
43947 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43948 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43949 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43950 ret_ref = (uintptr_t)ret_var.inner;
43951 if (ret_var.is_owned) {
43957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
43958 LDKSignedRawInvoice this_arg_conv;
43959 this_arg_conv.inner = (void*)(this_arg & (~1));
43960 this_arg_conv.is_owned = false;
43961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43962 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
43963 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
43964 return (uintptr_t)ret_conv;
43967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
43968 LDKSignedRawInvoice this_arg_conv;
43969 this_arg_conv.inner = (void*)(this_arg & (~1));
43970 this_arg_conv.is_owned = false;
43971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43972 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
43976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
43977 LDKRawInvoice this_arg_conv;
43978 this_arg_conv.inner = (void*)(this_arg & (~1));
43979 this_arg_conv.is_owned = false;
43980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43981 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43982 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
43986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
43987 LDKRawInvoice this_arg_conv;
43988 this_arg_conv.inner = (void*)(this_arg & (~1));
43989 this_arg_conv.is_owned = false;
43990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43991 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
43992 uintptr_t ret_ref = 0;
43993 if ((uintptr_t)ret_var.inner > 4096) {
43994 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43995 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43997 ret_ref = (uintptr_t)ret_var.inner;
43998 if (ret_var.is_owned) {
44005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
44006 LDKRawInvoice this_arg_conv;
44007 this_arg_conv.inner = (void*)(this_arg & (~1));
44008 this_arg_conv.is_owned = false;
44009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44010 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
44011 uintptr_t ret_ref = 0;
44012 if ((uintptr_t)ret_var.inner > 4096) {
44013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44016 ret_ref = (uintptr_t)ret_var.inner;
44017 if (ret_var.is_owned) {
44024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
44025 LDKRawInvoice this_arg_conv;
44026 this_arg_conv.inner = (void*)(this_arg & (~1));
44027 this_arg_conv.is_owned = false;
44028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44029 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
44030 uintptr_t ret_ref = 0;
44031 if ((uintptr_t)ret_var.inner > 4096) {
44032 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44033 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44035 ret_ref = (uintptr_t)ret_var.inner;
44036 if (ret_var.is_owned) {
44043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44044 LDKRawInvoice this_arg_conv;
44045 this_arg_conv.inner = (void*)(this_arg & (~1));
44046 this_arg_conv.is_owned = false;
44047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44048 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
44049 uintptr_t ret_ref = 0;
44050 if ((uintptr_t)ret_var.inner > 4096) {
44051 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44052 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44054 ret_ref = (uintptr_t)ret_var.inner;
44055 if (ret_var.is_owned) {
44062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
44063 LDKRawInvoice this_arg_conv;
44064 this_arg_conv.inner = (void*)(this_arg & (~1));
44065 this_arg_conv.is_owned = false;
44066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44067 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
44068 uintptr_t ret_ref = 0;
44069 if ((uintptr_t)ret_var.inner > 4096) {
44070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44073 ret_ref = (uintptr_t)ret_var.inner;
44074 if (ret_var.is_owned) {
44081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
44082 LDKRawInvoice this_arg_conv;
44083 this_arg_conv.inner = (void*)(this_arg & (~1));
44084 this_arg_conv.is_owned = false;
44085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44086 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
44087 uintptr_t ret_ref = 0;
44088 if ((uintptr_t)ret_var.inner > 4096) {
44089 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44090 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44092 ret_ref = (uintptr_t)ret_var.inner;
44093 if (ret_var.is_owned) {
44100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
44101 LDKRawInvoice this_arg_conv;
44102 this_arg_conv.inner = (void*)(this_arg & (~1));
44103 this_arg_conv.is_owned = false;
44104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44105 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44106 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
44110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44111 LDKRawInvoice this_arg_conv;
44112 this_arg_conv.inner = (void*)(this_arg & (~1));
44113 this_arg_conv.is_owned = false;
44114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44115 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
44116 uintptr_t ret_ref = 0;
44117 if ((uintptr_t)ret_var.inner > 4096) {
44118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44121 ret_ref = (uintptr_t)ret_var.inner;
44122 if (ret_var.is_owned) {
44129 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
44130 LDKRawInvoice this_arg_conv;
44131 this_arg_conv.inner = (void*)(this_arg & (~1));
44132 this_arg_conv.is_owned = false;
44133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44134 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
44135 int64_tArray ret_arr = NULL;
44136 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44137 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44138 for (size_t o = 0; o < ret_var.datalen; o++) {
44139 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
44140 uintptr_t ret_conv_14_ref = 0;
44141 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44142 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44144 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
44145 if (ret_conv_14_var.is_owned) {
44146 ret_conv_14_ref |= 1;
44148 ret_arr_ptr[o] = ret_conv_14_ref;
44150 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44151 FREE(ret_var.data);
44155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
44156 LDKRawInvoice this_arg_conv;
44157 this_arg_conv.inner = (void*)(this_arg & (~1));
44158 this_arg_conv.is_owned = false;
44159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44160 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44161 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
44162 uintptr_t ret_ref = (uintptr_t)ret_copy;
44166 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
44167 LDKRawInvoice this_arg_conv;
44168 this_arg_conv.inner = (void*)(this_arg & (~1));
44169 this_arg_conv.is_owned = false;
44170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44171 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
44175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
44176 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
44177 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
44178 return (uintptr_t)ret_conv;
44181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
44182 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
44183 *ret_conv = PositiveTimestamp_from_system_time(time);
44184 return (uintptr_t)ret_conv;
44187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
44188 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
44189 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
44190 return (uintptr_t)ret_conv;
44193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
44194 LDKPositiveTimestamp this_arg_conv;
44195 this_arg_conv.inner = (void*)(this_arg & (~1));
44196 this_arg_conv.is_owned = false;
44197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44198 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
44202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
44203 LDKPositiveTimestamp this_arg_conv;
44204 this_arg_conv.inner = (void*)(this_arg & (~1));
44205 this_arg_conv.is_owned = false;
44206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44207 int64_t ret_val = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
44211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
44212 LDKPositiveTimestamp this_arg_conv;
44213 this_arg_conv.inner = (void*)(this_arg & (~1));
44214 this_arg_conv.is_owned = false;
44215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44216 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
44220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
44221 LDKInvoice this_arg_conv;
44222 this_arg_conv.inner = (void*)(this_arg & (~1));
44223 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44225 this_arg_conv = Invoice_clone(&this_arg_conv);
44226 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
44227 uintptr_t ret_ref = 0;
44228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44231 ret_ref = (uintptr_t)ret_var.inner;
44232 if (ret_var.is_owned) {
44238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
44239 LDKInvoice this_arg_conv;
44240 this_arg_conv.inner = (void*)(this_arg & (~1));
44241 this_arg_conv.is_owned = false;
44242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44243 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
44244 *ret_conv = Invoice_check_signature(&this_arg_conv);
44245 return (uintptr_t)ret_conv;
44248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
44249 LDKSignedRawInvoice signed_invoice_conv;
44250 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
44251 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
44252 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
44253 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
44254 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
44255 *ret_conv = Invoice_from_signed(signed_invoice_conv);
44256 return (uintptr_t)ret_conv;
44259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
44260 LDKInvoice this_arg_conv;
44261 this_arg_conv.inner = (void*)(this_arg & (~1));
44262 this_arg_conv.is_owned = false;
44263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44264 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
44268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
44269 LDKInvoice this_arg_conv;
44270 this_arg_conv.inner = (void*)(this_arg & (~1));
44271 this_arg_conv.is_owned = false;
44272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44273 int64_t ret_val = Invoice_duration_since_epoch(&this_arg_conv);
44277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44278 LDKInvoice this_arg_conv;
44279 this_arg_conv.inner = (void*)(this_arg & (~1));
44280 this_arg_conv.is_owned = false;
44281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44282 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44283 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
44287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
44288 LDKInvoice this_arg_conv;
44289 this_arg_conv.inner = (void*)(this_arg & (~1));
44290 this_arg_conv.is_owned = false;
44291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44292 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44293 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
44297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
44298 LDKInvoice this_arg_conv;
44299 this_arg_conv.inner = (void*)(this_arg & (~1));
44300 this_arg_conv.is_owned = false;
44301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44302 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44303 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
44307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44308 LDKInvoice this_arg_conv;
44309 this_arg_conv.inner = (void*)(this_arg & (~1));
44310 this_arg_conv.is_owned = false;
44311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44312 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
44313 uintptr_t ret_ref = 0;
44314 if ((uintptr_t)ret_var.inner > 4096) {
44315 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44316 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44317 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44318 ret_ref = (uintptr_t)ret_var.inner;
44319 if (ret_var.is_owned) {
44326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
44327 LDKInvoice this_arg_conv;
44328 this_arg_conv.inner = (void*)(this_arg & (~1));
44329 this_arg_conv.is_owned = false;
44330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44331 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44332 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
44336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
44337 LDKInvoice this_arg_conv;
44338 this_arg_conv.inner = (void*)(this_arg & (~1));
44339 this_arg_conv.is_owned = false;
44340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44341 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
44345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
44346 LDKInvoice this_arg_conv;
44347 this_arg_conv.inner = (void*)(this_arg & (~1));
44348 this_arg_conv.is_owned = false;
44349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44350 jboolean ret_val = Invoice_is_expired(&this_arg_conv);
44354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
44355 LDKInvoice this_arg_conv;
44356 this_arg_conv.inner = (void*)(this_arg & (~1));
44357 this_arg_conv.is_owned = false;
44358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44359 jboolean ret_val = Invoice_would_expire(&this_arg_conv, at_time);
44363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
44364 LDKInvoice this_arg_conv;
44365 this_arg_conv.inner = (void*)(this_arg & (~1));
44366 this_arg_conv.is_owned = false;
44367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44368 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
44372 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
44373 LDKInvoice this_arg_conv;
44374 this_arg_conv.inner = (void*)(this_arg & (~1));
44375 this_arg_conv.is_owned = false;
44376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44377 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
44378 int64_tArray ret_arr = NULL;
44379 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44380 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44381 for (size_t o = 0; o < ret_var.datalen; o++) {
44382 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
44383 uintptr_t ret_conv_14_ref = 0;
44384 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44385 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44387 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
44388 if (ret_conv_14_var.is_owned) {
44389 ret_conv_14_ref |= 1;
44391 ret_arr_ptr[o] = ret_conv_14_ref;
44393 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44394 FREE(ret_var.data);
44398 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
44399 LDKInvoice this_arg_conv;
44400 this_arg_conv.inner = (void*)(this_arg & (~1));
44401 this_arg_conv.is_owned = false;
44402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44403 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
44404 int64_tArray ret_arr = NULL;
44405 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44406 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44407 for (size_t l = 0; l < ret_var.datalen; l++) {
44408 LDKRouteHint ret_conv_11_var = ret_var.data[l];
44409 uintptr_t ret_conv_11_ref = 0;
44410 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44411 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44412 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
44413 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
44414 if (ret_conv_11_var.is_owned) {
44415 ret_conv_11_ref |= 1;
44417 ret_arr_ptr[l] = ret_conv_11_ref;
44419 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44420 FREE(ret_var.data);
44424 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
44425 LDKInvoice this_arg_conv;
44426 this_arg_conv.inner = (void*)(this_arg & (~1));
44427 this_arg_conv.is_owned = false;
44428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44429 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
44433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
44434 LDKInvoice this_arg_conv;
44435 this_arg_conv.inner = (void*)(this_arg & (~1));
44436 this_arg_conv.is_owned = false;
44437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44438 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44439 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
44440 uintptr_t ret_ref = (uintptr_t)ret_copy;
44444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
44445 LDKStr description_conv = java_to_owned_str(env, description);
44446 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
44447 *ret_conv = Description_new(description_conv);
44448 return (uintptr_t)ret_conv;
44451 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
44452 LDKDescription this_arg_conv;
44453 this_arg_conv.inner = (void*)(this_arg & (~1));
44454 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44456 this_arg_conv = Description_clone(&this_arg_conv);
44457 LDKStr ret_str = Description_into_inner(this_arg_conv);
44458 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
44463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
44464 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
44465 uintptr_t ret_ref = 0;
44466 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44467 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44469 ret_ref = (uintptr_t)ret_var.inner;
44470 if (ret_var.is_owned) {
44476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
44477 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
44478 uintptr_t ret_ref = 0;
44479 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44480 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44481 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44482 ret_ref = (uintptr_t)ret_var.inner;
44483 if (ret_var.is_owned) {
44489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
44490 LDKExpiryTime this_arg_conv;
44491 this_arg_conv.inner = (void*)(this_arg & (~1));
44492 this_arg_conv.is_owned = false;
44493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44494 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
44498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
44499 LDKExpiryTime this_arg_conv;
44500 this_arg_conv.inner = (void*)(this_arg & (~1));
44501 this_arg_conv.is_owned = false;
44502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44503 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
44507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
44508 LDKRouteHint hops_conv;
44509 hops_conv.inner = (void*)(hops & (~1));
44510 hops_conv.is_owned = (hops & 1) || (hops == 0);
44511 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
44512 hops_conv = RouteHint_clone(&hops_conv);
44513 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
44514 *ret_conv = PrivateRoute_new(hops_conv);
44515 return (uintptr_t)ret_conv;
44518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
44519 LDKPrivateRoute this_arg_conv;
44520 this_arg_conv.inner = (void*)(this_arg & (~1));
44521 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44523 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
44524 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
44525 uintptr_t ret_ref = 0;
44526 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44527 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44528 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44529 ret_ref = (uintptr_t)ret_var.inner;
44530 if (ret_var.is_owned) {
44536 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44537 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
44538 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
44542 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
44543 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
44547 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
44548 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
44552 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
44553 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
44557 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
44558 jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
44562 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
44563 jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
44567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44568 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
44569 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
44570 jboolean ret_val = CreationError_eq(a_conv, b_conv);
44574 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
44575 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
44576 LDKStr ret_str = CreationError_to_str(o_conv);
44577 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
44582 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44583 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
44584 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
44588 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
44589 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
44593 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
44594 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
44598 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
44599 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
44603 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
44604 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
44608 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
44609 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
44613 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
44614 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
44618 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
44619 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
44623 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
44624 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
44628 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
44629 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
44633 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
44634 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
44638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44639 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
44640 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
44641 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
44645 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
44646 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
44647 LDKStr ret_str = SemanticError_to_str(o_conv);
44648 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
44653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44654 if ((this_ptr & 1) != 0) return;
44655 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44656 CHECK_ACCESS(this_ptr_ptr);
44657 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
44658 FREE((void*)this_ptr);
44659 SignOrCreationError_free(this_ptr_conv);
44662 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
44663 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
44664 *ret_copy = SignOrCreationError_clone(arg);
44665 uintptr_t ret_ref = (uintptr_t)ret_copy;
44668 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44669 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
44670 intptr_t ret_val = SignOrCreationError_clone_ptr(arg_conv);
44674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44675 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
44676 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
44677 *ret_copy = SignOrCreationError_clone(orig_conv);
44678 uintptr_t ret_ref = (uintptr_t)ret_copy;
44682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
44683 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
44684 *ret_copy = SignOrCreationError_sign_error();
44685 uintptr_t ret_ref = (uintptr_t)ret_copy;
44689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
44690 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
44691 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
44692 *ret_copy = SignOrCreationError_creation_error(a_conv);
44693 uintptr_t ret_ref = (uintptr_t)ret_copy;
44697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44698 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
44699 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
44700 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
44704 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
44705 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
44706 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
44707 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
44712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44713 LDKInvoicePayer this_obj_conv;
44714 this_obj_conv.inner = (void*)(this_obj & (~1));
44715 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44717 InvoicePayer_free(this_obj_conv);
44720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44721 if ((this_ptr & 1) != 0) return;
44722 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44723 CHECK_ACCESS(this_ptr_ptr);
44724 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
44725 FREE((void*)this_ptr);
44726 Payer_free(this_ptr_conv);
44729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44730 if ((this_ptr & 1) != 0) return;
44731 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44732 CHECK_ACCESS(this_ptr_ptr);
44733 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
44734 FREE((void*)this_ptr);
44735 Router_free(this_ptr_conv);
44738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44739 LDKRetryAttempts this_obj_conv;
44740 this_obj_conv.inner = (void*)(this_obj & (~1));
44741 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44743 RetryAttempts_free(this_obj_conv);
44746 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44747 LDKRetryAttempts this_ptr_conv;
44748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44749 this_ptr_conv.is_owned = false;
44750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44751 intptr_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
44755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, intptr_t val) {
44756 LDKRetryAttempts this_ptr_conv;
44757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44758 this_ptr_conv.is_owned = false;
44759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44760 RetryAttempts_set_a(&this_ptr_conv, val);
44763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1new(JNIEnv *env, jclass clz, intptr_t a_arg) {
44764 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
44765 uintptr_t ret_ref = 0;
44766 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44767 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44769 ret_ref = (uintptr_t)ret_var.inner;
44770 if (ret_var.is_owned) {
44776 static inline uintptr_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
44777 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
44778 uintptr_t ret_ref = 0;
44779 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44780 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44781 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44782 ret_ref = (uintptr_t)ret_var.inner;
44783 if (ret_var.is_owned) {
44788 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44789 LDKRetryAttempts arg_conv;
44790 arg_conv.inner = (void*)(arg & (~1));
44791 arg_conv.is_owned = false;
44792 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44793 intptr_t ret_val = RetryAttempts_clone_ptr(&arg_conv);
44797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44798 LDKRetryAttempts orig_conv;
44799 orig_conv.inner = (void*)(orig & (~1));
44800 orig_conv.is_owned = false;
44801 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44802 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
44803 uintptr_t ret_ref = 0;
44804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44807 ret_ref = (uintptr_t)ret_var.inner;
44808 if (ret_var.is_owned) {
44814 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44815 LDKRetryAttempts a_conv;
44816 a_conv.inner = (void*)(a & (~1));
44817 a_conv.is_owned = false;
44818 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44819 LDKRetryAttempts b_conv;
44820 b_conv.inner = (void*)(b & (~1));
44821 b_conv.is_owned = false;
44822 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44823 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
44827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1hash(JNIEnv *env, jclass clz, int64_t o) {
44828 LDKRetryAttempts o_conv;
44829 o_conv.inner = (void*)(o & (~1));
44830 o_conv.is_owned = false;
44831 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44832 int64_t ret_val = RetryAttempts_hash(&o_conv);
44836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44837 if ((this_ptr & 1) != 0) return;
44838 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44839 CHECK_ACCESS(this_ptr_ptr);
44840 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
44841 FREE((void*)this_ptr);
44842 PaymentError_free(this_ptr_conv);
44845 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
44846 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
44847 *ret_copy = PaymentError_clone(arg);
44848 uintptr_t ret_ref = (uintptr_t)ret_copy;
44851 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44852 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
44853 intptr_t ret_val = PaymentError_clone_ptr(arg_conv);
44857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44858 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
44859 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
44860 *ret_copy = PaymentError_clone(orig_conv);
44861 uintptr_t ret_ref = (uintptr_t)ret_copy;
44865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
44866 LDKStr a_conv = java_to_owned_str(env, a);
44867 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
44868 *ret_copy = PaymentError_invoice(a_conv);
44869 uintptr_t ret_ref = (uintptr_t)ret_copy;
44873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
44874 LDKLightningError a_conv;
44875 a_conv.inner = (void*)(a & (~1));
44876 a_conv.is_owned = (a & 1) || (a == 0);
44877 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44878 a_conv = LightningError_clone(&a_conv);
44879 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
44880 *ret_copy = PaymentError_routing(a_conv);
44881 uintptr_t ret_ref = (uintptr_t)ret_copy;
44885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
44886 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
44887 CHECK_ACCESS(a_ptr);
44888 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
44889 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
44890 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
44891 *ret_copy = PaymentError_sending(a_conv);
44892 uintptr_t ret_ref = (uintptr_t)ret_copy;
44896 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) {
44897 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
44898 CHECK_ACCESS(payer_ptr);
44899 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
44900 if (payer_conv.free == LDKPayer_JCalls_free) {
44901 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44902 LDKPayer_JCalls_cloned(&payer_conv);
44904 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
44905 CHECK_ACCESS(router_ptr);
44906 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
44907 if (router_conv.free == LDKRouter_JCalls_free) {
44908 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44909 LDKRouter_JCalls_cloned(&router_conv);
44911 LDKMultiThreadedLockableScore scorer_conv;
44912 scorer_conv.inner = (void*)(scorer & (~1));
44913 scorer_conv.is_owned = false;
44914 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
44915 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
44916 CHECK_ACCESS(logger_ptr);
44917 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44918 if (logger_conv.free == LDKLogger_JCalls_free) {
44919 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44920 LDKLogger_JCalls_cloned(&logger_conv);
44922 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
44923 CHECK_ACCESS(event_handler_ptr);
44924 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
44925 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
44926 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44927 LDKEventHandler_JCalls_cloned(&event_handler_conv);
44929 LDKRetryAttempts retry_attempts_conv;
44930 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
44931 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
44932 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
44933 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
44934 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
44935 uintptr_t ret_ref = 0;
44936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44939 ret_ref = (uintptr_t)ret_var.inner;
44940 if (ret_var.is_owned) {
44946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
44947 LDKInvoicePayer this_arg_conv;
44948 this_arg_conv.inner = (void*)(this_arg & (~1));
44949 this_arg_conv.is_owned = false;
44950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44951 LDKInvoice invoice_conv;
44952 invoice_conv.inner = (void*)(invoice & (~1));
44953 invoice_conv.is_owned = false;
44954 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
44955 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
44956 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
44957 return (uintptr_t)ret_conv;
44960 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) {
44961 LDKInvoicePayer this_arg_conv;
44962 this_arg_conv.inner = (void*)(this_arg & (~1));
44963 this_arg_conv.is_owned = false;
44964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44965 LDKInvoice invoice_conv;
44966 invoice_conv.inner = (void*)(invoice & (~1));
44967 invoice_conv.is_owned = false;
44968 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
44969 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
44970 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
44971 return (uintptr_t)ret_conv;
44974 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) {
44975 LDKInvoicePayer this_arg_conv;
44976 this_arg_conv.inner = (void*)(this_arg & (~1));
44977 this_arg_conv.is_owned = false;
44978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44979 LDKPublicKey pubkey_ref;
44980 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
44981 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
44982 LDKThirtyTwoBytes payment_preimage_ref;
44983 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
44984 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
44985 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
44986 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
44987 return (uintptr_t)ret_conv;
44990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
44991 LDKInvoicePayer this_arg_conv;
44992 this_arg_conv.inner = (void*)(this_arg & (~1));
44993 this_arg_conv.is_owned = false;
44994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44995 unsigned char payment_hash_arr[32];
44996 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44997 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
44998 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
44999 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
45002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
45003 LDKInvoicePayer this_arg_conv;
45004 this_arg_conv.inner = (void*)(this_arg & (~1));
45005 this_arg_conv.is_owned = false;
45006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45007 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
45008 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
45009 return (uintptr_t)ret_ret;
45012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, jstring description, int8_tArray payment_hash, int8_tArray payment_secret, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) {
45013 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
45014 CHECK_ACCESS(amt_msat_ptr);
45015 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
45016 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
45017 LDKStr description_conv = java_to_owned_str(env, description);
45018 LDKThirtyTwoBytes payment_hash_ref;
45019 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
45020 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
45021 LDKThirtyTwoBytes payment_secret_ref;
45022 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
45023 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
45024 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
45025 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
45026 if (phantom_route_hints_constr.datalen > 0)
45027 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
45029 phantom_route_hints_constr.data = NULL;
45030 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
45031 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
45032 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
45033 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
45034 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
45035 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
45036 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
45037 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
45038 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
45040 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
45041 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
45042 CHECK_ACCESS(keys_manager_ptr);
45043 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45044 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45045 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45046 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45048 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
45049 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
45050 *ret_conv = create_phantom_invoice(amt_msat_conv, description_conv, payment_hash_ref, payment_secret_ref, phantom_route_hints_constr, keys_manager_conv, network_conv);
45051 return (uintptr_t)ret_conv;
45054 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) {
45055 LDKChannelManager channelmanager_conv;
45056 channelmanager_conv.inner = (void*)(channelmanager & (~1));
45057 channelmanager_conv.is_owned = false;
45058 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
45059 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
45060 CHECK_ACCESS(keys_manager_ptr);
45061 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45062 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45063 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45064 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45066 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
45067 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
45068 CHECK_ACCESS(amt_msat_ptr);
45069 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
45070 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
45071 LDKStr description_conv = java_to_owned_str(env, description);
45072 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
45073 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
45074 return (uintptr_t)ret_conv;
45077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch) {
45078 LDKChannelManager channelmanager_conv;
45079 channelmanager_conv.inner = (void*)(channelmanager & (~1));
45080 channelmanager_conv.is_owned = false;
45081 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
45082 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
45083 CHECK_ACCESS(keys_manager_ptr);
45084 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45085 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45086 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45087 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45089 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
45090 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
45091 CHECK_ACCESS(amt_msat_ptr);
45092 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
45093 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
45094 LDKStr description_conv = java_to_owned_str(env, description);
45095 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
45096 *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch);
45097 return (uintptr_t)ret_conv;
45100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45101 LDKDefaultRouter this_obj_conv;
45102 this_obj_conv.inner = (void*)(this_obj & (~1));
45103 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45105 DefaultRouter_free(this_obj_conv);
45108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
45109 LDKNetworkGraph network_graph_conv;
45110 network_graph_conv.inner = (void*)(network_graph & (~1));
45111 network_graph_conv.is_owned = false;
45112 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45113 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45114 CHECK_ACCESS(logger_ptr);
45115 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45116 if (logger_conv.free == LDKLogger_JCalls_free) {
45117 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45118 LDKLogger_JCalls_cloned(&logger_conv);
45120 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
45121 uintptr_t ret_ref = 0;
45122 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45123 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45125 ret_ref = (uintptr_t)ret_var.inner;
45126 if (ret_var.is_owned) {
45132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
45133 LDKDefaultRouter this_arg_conv;
45134 this_arg_conv.inner = (void*)(this_arg & (~1));
45135 this_arg_conv.is_owned = false;
45136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45137 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
45138 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
45139 return (uintptr_t)ret_ret;
45142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
45143 LDKChannelManager this_arg_conv;
45144 this_arg_conv.inner = (void*)(this_arg & (~1));
45145 this_arg_conv.is_owned = false;
45146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45147 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
45148 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
45149 return (uintptr_t)ret_ret;
45152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
45153 LDKStr s_conv = java_to_owned_str(env, s);
45154 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
45155 *ret_conv = SiPrefix_from_str(s_conv);
45156 return (uintptr_t)ret_conv;
45159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
45160 LDKStr s_conv = java_to_owned_str(env, s);
45161 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
45162 *ret_conv = Invoice_from_str(s_conv);
45163 return (uintptr_t)ret_conv;
45166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
45167 LDKStr s_conv = java_to_owned_str(env, s);
45168 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
45169 *ret_conv = SignedRawInvoice_from_str(s_conv);
45170 return (uintptr_t)ret_conv;
45173 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45175 o_conv.inner = (void*)(o & (~1));
45176 o_conv.is_owned = false;
45177 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45178 LDKStr ret_str = Invoice_to_str(&o_conv);
45179 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45184 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45185 LDKSignedRawInvoice o_conv;
45186 o_conv.inner = (void*)(o & (~1));
45187 o_conv.is_owned = false;
45188 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45189 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
45190 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45195 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45196 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
45197 LDKStr ret_str = Currency_to_str(o_conv);
45198 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45203 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45204 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
45205 LDKStr ret_str = SiPrefix_to_str(o_conv);
45206 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);