1 #include "org_ldk_impl_bindings.h"
7 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
8 #define MALLOC(a, _) malloc(a)
9 #define FREE(p) if ((uint64_t)(p) > 1024) { free(p); }
10 #define DO_ASSERT(a) (void)(a)
13 static jmethodID ordinal_meth = NULL;
14 static jmethodID slicedef_meth = NULL;
15 static jclass slicedef_cls = NULL;
16 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
17 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
18 CHECK(ordinal_meth != NULL);
19 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
20 CHECK(slicedef_meth != NULL);
21 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
22 CHECK(slicedef_cls != NULL);
25 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
28 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
31 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
34 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
35 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
36 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
39 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
40 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
41 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
42 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
45 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
46 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
47 vec->datalen = (*env)->GetArrayLength(env, bytes);
48 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
49 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
52 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
53 LDKTransaction *txdata = (LDKTransaction*)ptr;
55 slice.data = txdata->data;
56 slice.datalen = txdata->datalen;
57 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
59 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
60 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
61 txdata->datalen = (*env)->GetArrayLength(env, bytes);
62 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
63 txdata->data_is_owned = false;
64 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
65 return (uint64_t)txdata;
67 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
68 LDKTransaction *tx = (LDKTransaction*)ptr;
69 tx->data_is_owned = true;
70 Transaction_free(*tx);
73 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
74 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
75 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
76 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
77 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
78 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
79 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
80 return (uint64_t)vec->datalen;
82 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
83 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
84 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
85 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
86 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
87 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
88 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
94 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
95 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
96 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
97 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
99 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
100 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
101 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
103 typedef jlongArray int64_tArray;
104 typedef jbyteArray int8_tArray;
106 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
107 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
108 char* conv_buf = MALLOC(len + 1, "str conv buf");
109 memcpy(conv_buf, chars, len);
111 jstring ret = (*env)->NewStringUTF(env, conv_buf);
115 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
116 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
117 char* newchars = MALLOC(str_len + 1, "String chars");
118 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
119 memcpy(newchars, jchars, str_len);
120 newchars[str_len] = 0;
121 (*env)->ReleaseStringUTFChars(env, str, jchars);
125 .chars_is_owned = true
130 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
131 return str_ref_to_java(env, "v0.0.13-28-ga77a285", strlen("v0.0.13-28-ga77a285"));
133 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
134 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
136 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
137 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
139 static jclass arr_of_B_clz = NULL;
140 static jclass arr_of_J_clz = NULL;
141 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
142 arr_of_B_clz = (*env)->FindClass(env, "[B");
143 CHECK(arr_of_B_clz != NULL);
144 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
145 arr_of_J_clz = (*env)->FindClass(env, "[J");
146 CHECK(arr_of_J_clz != NULL);
147 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
149 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
150 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
151 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
152 case 0: return LDKAccessError_UnknownChain;
153 case 1: return LDKAccessError_UnknownTx;
157 static jclass AccessError_class = NULL;
158 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
159 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
160 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
161 AccessError_class = (*env)->NewGlobalRef(env, clz);
162 CHECK(AccessError_class != NULL);
163 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
164 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
165 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
166 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
168 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
170 case LDKAccessError_UnknownChain:
171 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
172 case LDKAccessError_UnknownTx:
173 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
178 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
179 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
180 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
181 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
185 static jclass ChannelMonitorUpdateErr_class = NULL;
186 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
187 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
188 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
189 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
190 CHECK(ChannelMonitorUpdateErr_class != NULL);
191 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
192 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
193 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
194 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
196 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
198 case LDKChannelMonitorUpdateErr_TemporaryFailure:
199 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
200 case LDKChannelMonitorUpdateErr_PermanentFailure:
201 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
206 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
207 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
208 case 0: return LDKConfirmationTarget_Background;
209 case 1: return LDKConfirmationTarget_Normal;
210 case 2: return LDKConfirmationTarget_HighPriority;
214 static jclass ConfirmationTarget_class = NULL;
215 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
216 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
217 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
218 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
219 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
220 CHECK(ConfirmationTarget_class != NULL);
221 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
222 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
223 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
224 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
225 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
226 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
228 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
230 case LDKConfirmationTarget_Background:
231 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
232 case LDKConfirmationTarget_Normal:
233 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
234 case LDKConfirmationTarget_HighPriority:
235 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
240 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
241 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
242 case 0: return LDKCreationError_DescriptionTooLong;
243 case 1: return LDKCreationError_RouteTooLong;
244 case 2: return LDKCreationError_TimestampOutOfBounds;
245 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
249 static jclass CreationError_class = NULL;
250 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
251 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
252 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
253 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
254 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
255 CreationError_class = (*env)->NewGlobalRef(env, clz);
256 CHECK(CreationError_class != NULL);
257 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
258 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
259 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
260 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
261 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
262 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
263 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
264 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
266 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
268 case LDKCreationError_DescriptionTooLong:
269 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
270 case LDKCreationError_RouteTooLong:
271 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
272 case LDKCreationError_TimestampOutOfBounds:
273 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
274 case LDKCreationError_ExpiryTimeOutOfBounds:
275 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
280 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
281 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
282 case 0: return LDKCurrency_Bitcoin;
283 case 1: return LDKCurrency_BitcoinTestnet;
284 case 2: return LDKCurrency_Regtest;
285 case 3: return LDKCurrency_Simnet;
286 case 4: return LDKCurrency_Signet;
290 static jclass Currency_class = NULL;
291 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
292 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
293 static jfieldID Currency_LDKCurrency_Regtest = NULL;
294 static jfieldID Currency_LDKCurrency_Simnet = NULL;
295 static jfieldID Currency_LDKCurrency_Signet = NULL;
296 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
297 Currency_class = (*env)->NewGlobalRef(env, clz);
298 CHECK(Currency_class != NULL);
299 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
300 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
301 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
302 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
303 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
304 CHECK(Currency_LDKCurrency_Regtest != NULL);
305 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
306 CHECK(Currency_LDKCurrency_Simnet != NULL);
307 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
308 CHECK(Currency_LDKCurrency_Signet != NULL);
310 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
312 case LDKCurrency_Bitcoin:
313 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
314 case LDKCurrency_BitcoinTestnet:
315 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
316 case LDKCurrency_Regtest:
317 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
318 case LDKCurrency_Simnet:
319 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
320 case LDKCurrency_Signet:
321 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
326 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
327 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
328 case 0: return LDKIOError_NotFound;
329 case 1: return LDKIOError_PermissionDenied;
330 case 2: return LDKIOError_ConnectionRefused;
331 case 3: return LDKIOError_ConnectionReset;
332 case 4: return LDKIOError_ConnectionAborted;
333 case 5: return LDKIOError_NotConnected;
334 case 6: return LDKIOError_AddrInUse;
335 case 7: return LDKIOError_AddrNotAvailable;
336 case 8: return LDKIOError_BrokenPipe;
337 case 9: return LDKIOError_AlreadyExists;
338 case 10: return LDKIOError_WouldBlock;
339 case 11: return LDKIOError_InvalidInput;
340 case 12: return LDKIOError_InvalidData;
341 case 13: return LDKIOError_TimedOut;
342 case 14: return LDKIOError_WriteZero;
343 case 15: return LDKIOError_Interrupted;
344 case 16: return LDKIOError_Other;
345 case 17: return LDKIOError_UnexpectedEof;
349 static jclass IOError_class = NULL;
350 static jfieldID IOError_LDKIOError_NotFound = NULL;
351 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
352 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
353 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
354 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
355 static jfieldID IOError_LDKIOError_NotConnected = NULL;
356 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
357 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
358 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
359 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
360 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
361 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
362 static jfieldID IOError_LDKIOError_InvalidData = NULL;
363 static jfieldID IOError_LDKIOError_TimedOut = NULL;
364 static jfieldID IOError_LDKIOError_WriteZero = NULL;
365 static jfieldID IOError_LDKIOError_Interrupted = NULL;
366 static jfieldID IOError_LDKIOError_Other = NULL;
367 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
368 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
369 IOError_class = (*env)->NewGlobalRef(env, clz);
370 CHECK(IOError_class != NULL);
371 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
372 CHECK(IOError_LDKIOError_NotFound != NULL);
373 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
374 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
375 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
376 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
377 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
378 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
379 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
380 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
381 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
382 CHECK(IOError_LDKIOError_NotConnected != NULL);
383 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
384 CHECK(IOError_LDKIOError_AddrInUse != NULL);
385 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
386 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
387 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
388 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
389 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
390 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
391 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
392 CHECK(IOError_LDKIOError_WouldBlock != NULL);
393 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
394 CHECK(IOError_LDKIOError_InvalidInput != NULL);
395 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
396 CHECK(IOError_LDKIOError_InvalidData != NULL);
397 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
398 CHECK(IOError_LDKIOError_TimedOut != NULL);
399 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
400 CHECK(IOError_LDKIOError_WriteZero != NULL);
401 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
402 CHECK(IOError_LDKIOError_Interrupted != NULL);
403 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
404 CHECK(IOError_LDKIOError_Other != NULL);
405 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
406 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
408 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
410 case LDKIOError_NotFound:
411 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
412 case LDKIOError_PermissionDenied:
413 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
414 case LDKIOError_ConnectionRefused:
415 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
416 case LDKIOError_ConnectionReset:
417 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
418 case LDKIOError_ConnectionAborted:
419 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
420 case LDKIOError_NotConnected:
421 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
422 case LDKIOError_AddrInUse:
423 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
424 case LDKIOError_AddrNotAvailable:
425 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
426 case LDKIOError_BrokenPipe:
427 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
428 case LDKIOError_AlreadyExists:
429 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
430 case LDKIOError_WouldBlock:
431 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
432 case LDKIOError_InvalidInput:
433 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
434 case LDKIOError_InvalidData:
435 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
436 case LDKIOError_TimedOut:
437 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
438 case LDKIOError_WriteZero:
439 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
440 case LDKIOError_Interrupted:
441 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
442 case LDKIOError_Other:
443 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
444 case LDKIOError_UnexpectedEof:
445 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
450 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
451 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
452 case 0: return LDKLevel_Off;
453 case 1: return LDKLevel_Error;
454 case 2: return LDKLevel_Warn;
455 case 3: return LDKLevel_Info;
456 case 4: return LDKLevel_Debug;
457 case 5: return LDKLevel_Trace;
461 static jclass Level_class = NULL;
462 static jfieldID Level_LDKLevel_Off = NULL;
463 static jfieldID Level_LDKLevel_Error = NULL;
464 static jfieldID Level_LDKLevel_Warn = NULL;
465 static jfieldID Level_LDKLevel_Info = NULL;
466 static jfieldID Level_LDKLevel_Debug = NULL;
467 static jfieldID Level_LDKLevel_Trace = NULL;
468 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
469 Level_class = (*env)->NewGlobalRef(env, clz);
470 CHECK(Level_class != NULL);
471 Level_LDKLevel_Off = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Off", "Lorg/ldk/enums/Level;");
472 CHECK(Level_LDKLevel_Off != NULL);
473 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
474 CHECK(Level_LDKLevel_Error != NULL);
475 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
476 CHECK(Level_LDKLevel_Warn != NULL);
477 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
478 CHECK(Level_LDKLevel_Info != NULL);
479 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
480 CHECK(Level_LDKLevel_Debug != NULL);
481 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
482 CHECK(Level_LDKLevel_Trace != NULL);
484 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
487 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Off);
489 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
491 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
493 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
495 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
497 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
502 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
503 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
504 case 0: return LDKNetwork_Bitcoin;
505 case 1: return LDKNetwork_Testnet;
506 case 2: return LDKNetwork_Regtest;
507 case 3: return LDKNetwork_Signet;
511 static jclass Network_class = NULL;
512 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
513 static jfieldID Network_LDKNetwork_Testnet = NULL;
514 static jfieldID Network_LDKNetwork_Regtest = NULL;
515 static jfieldID Network_LDKNetwork_Signet = NULL;
516 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
517 Network_class = (*env)->NewGlobalRef(env, clz);
518 CHECK(Network_class != NULL);
519 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
520 CHECK(Network_LDKNetwork_Bitcoin != NULL);
521 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
522 CHECK(Network_LDKNetwork_Testnet != NULL);
523 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
524 CHECK(Network_LDKNetwork_Regtest != NULL);
525 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
526 CHECK(Network_LDKNetwork_Signet != NULL);
528 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
530 case LDKNetwork_Bitcoin:
531 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
532 case LDKNetwork_Testnet:
533 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
534 case LDKNetwork_Regtest:
535 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
536 case LDKNetwork_Signet:
537 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
542 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
543 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
544 case 0: return LDKSecp256k1Error_IncorrectSignature;
545 case 1: return LDKSecp256k1Error_InvalidMessage;
546 case 2: return LDKSecp256k1Error_InvalidPublicKey;
547 case 3: return LDKSecp256k1Error_InvalidSignature;
548 case 4: return LDKSecp256k1Error_InvalidSecretKey;
549 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
550 case 6: return LDKSecp256k1Error_InvalidTweak;
551 case 7: return LDKSecp256k1Error_TweakCheckFailed;
552 case 8: return LDKSecp256k1Error_NotEnoughMemory;
556 static jclass Secp256k1Error_class = NULL;
557 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
558 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
559 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
561 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
562 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
563 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
564 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
565 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
566 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
567 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
568 CHECK(Secp256k1Error_class != NULL);
569 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
570 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
571 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
572 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
573 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
574 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
575 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
576 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
577 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
578 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
579 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
580 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
581 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
582 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
583 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
584 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
585 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
586 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
588 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
590 case LDKSecp256k1Error_IncorrectSignature:
591 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
592 case LDKSecp256k1Error_InvalidMessage:
593 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
594 case LDKSecp256k1Error_InvalidPublicKey:
595 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
596 case LDKSecp256k1Error_InvalidSignature:
597 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
598 case LDKSecp256k1Error_InvalidSecretKey:
599 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
600 case LDKSecp256k1Error_InvalidRecoveryId:
601 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
602 case LDKSecp256k1Error_InvalidTweak:
603 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
604 case LDKSecp256k1Error_TweakCheckFailed:
605 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
606 case LDKSecp256k1Error_NotEnoughMemory:
607 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
612 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
613 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
614 case 0: return LDKSemanticError_NoPaymentHash;
615 case 1: return LDKSemanticError_MultiplePaymentHashes;
616 case 2: return LDKSemanticError_NoDescription;
617 case 3: return LDKSemanticError_MultipleDescriptions;
618 case 4: return LDKSemanticError_MultiplePaymentSecrets;
619 case 5: return LDKSemanticError_InvalidFeatures;
620 case 6: return LDKSemanticError_InvalidRecoveryId;
621 case 7: return LDKSemanticError_InvalidSignature;
625 static jclass SemanticError_class = NULL;
626 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
627 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
628 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
629 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
630 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
631 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
632 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
633 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
634 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
635 SemanticError_class = (*env)->NewGlobalRef(env, clz);
636 CHECK(SemanticError_class != NULL);
637 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
638 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
639 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
640 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
641 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
642 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
643 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
644 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
645 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
646 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
647 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
648 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
649 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
650 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
651 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
652 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
654 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
656 case LDKSemanticError_NoPaymentHash:
657 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
658 case LDKSemanticError_MultiplePaymentHashes:
659 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
660 case LDKSemanticError_NoDescription:
661 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
662 case LDKSemanticError_MultipleDescriptions:
663 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
664 case LDKSemanticError_MultiplePaymentSecrets:
665 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
666 case LDKSemanticError_InvalidFeatures:
667 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
668 case LDKSemanticError_InvalidRecoveryId:
669 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
670 case LDKSemanticError_InvalidSignature:
671 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
676 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
677 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
678 case 0: return LDKSiPrefix_Milli;
679 case 1: return LDKSiPrefix_Micro;
680 case 2: return LDKSiPrefix_Nano;
681 case 3: return LDKSiPrefix_Pico;
685 static jclass SiPrefix_class = NULL;
686 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
687 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
688 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
689 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
690 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
691 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
692 CHECK(SiPrefix_class != NULL);
693 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
694 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
695 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
696 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
697 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
698 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
699 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
700 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
702 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
704 case LDKSiPrefix_Milli:
705 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
706 case LDKSiPrefix_Micro:
707 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
708 case LDKSiPrefix_Nano:
709 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
710 case LDKSiPrefix_Pico:
711 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
717 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
718 ret->datalen = (*env)->GetArrayLength(env, elems);
719 if (ret->datalen == 0) {
722 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
723 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
724 for (size_t i = 0; i < ret->datalen; i++) {
725 ret->data[i] = java_elems[i];
727 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
729 return (uint64_t)ret;
731 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
732 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
733 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
737 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
740 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
741 CHECK(val->result_ok);
742 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
743 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
746 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
747 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
748 CHECK(!val->result_ok);
749 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
753 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
756 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
757 CHECK(val->result_ok);
758 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
759 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
762 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
763 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
764 CHECK(!val->result_ok);
765 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
769 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
772 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
773 CHECK(val->result_ok);
774 LDKTxCreationKeys res_var = (*val->contents.result);
775 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
776 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
777 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
781 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
782 CHECK(!val->result_ok);
783 LDKDecodeError err_var = (*val->contents.err);
784 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
785 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
786 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
789 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
790 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
793 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
794 CHECK(val->result_ok);
795 LDKChannelPublicKeys res_var = (*val->contents.result);
796 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
797 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
798 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
802 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
803 CHECK(!val->result_ok);
804 LDKDecodeError err_var = (*val->contents.err);
805 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
806 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
807 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
811 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
814 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
815 CHECK(val->result_ok);
816 LDKTxCreationKeys res_var = (*val->contents.result);
817 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
818 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
819 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
822 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
823 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
824 CHECK(!val->result_ok);
825 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
828 static jclass LDKCOption_u32Z_Some_class = NULL;
829 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
830 static jclass LDKCOption_u32Z_None_class = NULL;
831 static jmethodID LDKCOption_u32Z_None_meth = NULL;
832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
833 LDKCOption_u32Z_Some_class =
834 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
835 CHECK(LDKCOption_u32Z_Some_class != NULL);
836 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
837 CHECK(LDKCOption_u32Z_Some_meth != NULL);
838 LDKCOption_u32Z_None_class =
839 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
840 CHECK(LDKCOption_u32Z_None_class != NULL);
841 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
842 CHECK(LDKCOption_u32Z_None_meth != NULL);
844 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
845 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
847 case LDKCOption_u32Z_Some: {
848 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
850 case LDKCOption_u32Z_None: {
851 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
857 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
860 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
861 CHECK(val->result_ok);
862 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
863 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
864 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
865 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
869 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
870 CHECK(!val->result_ok);
871 LDKDecodeError err_var = (*val->contents.err);
872 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
873 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
874 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
878 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
881 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
882 CHECK(val->result_ok);
883 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
884 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
885 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
886 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
890 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
891 CHECK(!val->result_ok);
892 LDKDecodeError err_var = (*val->contents.err);
893 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
894 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
895 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
899 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
902 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
903 CHECK(val->result_ok);
904 LDKChannelTransactionParameters res_var = (*val->contents.result);
905 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
906 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
907 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
911 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
912 CHECK(!val->result_ok);
913 LDKDecodeError err_var = (*val->contents.err);
914 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
915 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
916 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
919 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
920 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
923 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
924 CHECK(val->result_ok);
925 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
926 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
927 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
928 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
932 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
933 CHECK(!val->result_ok);
934 LDKDecodeError err_var = (*val->contents.err);
935 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
936 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
937 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
941 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
944 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
945 CHECK(val->result_ok);
946 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
947 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
948 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
949 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
953 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
954 CHECK(!val->result_ok);
955 LDKDecodeError err_var = (*val->contents.err);
956 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
957 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
958 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
962 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
965 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
966 CHECK(val->result_ok);
967 LDKCommitmentTransaction res_var = (*val->contents.result);
968 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
969 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
970 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
974 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
975 CHECK(!val->result_ok);
976 LDKDecodeError err_var = (*val->contents.err);
977 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
978 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
979 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
983 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
986 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
987 CHECK(val->result_ok);
988 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
989 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
990 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
991 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
995 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
996 CHECK(!val->result_ok);
997 return *val->contents.err;
999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1000 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1002 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1003 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1004 CHECK(val->result_ok);
1005 LDKCVec_SignatureZ res_var = (*val->contents.result);
1006 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1008 for (size_t i = 0; i < res_var.datalen; i++) {
1009 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1010 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1011 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1016 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1017 CHECK(!val->result_ok);
1018 return *val->contents.err;
1020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1021 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1024 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1025 CHECK(val->result_ok);
1026 return *val->contents.result;
1028 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1029 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1030 CHECK(!val->result_ok);
1031 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1035 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1038 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1039 CHECK(val->result_ok);
1040 LDKRouteHop res_var = (*val->contents.result);
1041 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1042 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1043 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1047 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1048 CHECK(!val->result_ok);
1049 LDKDecodeError err_var = (*val->contents.err);
1050 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1051 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1052 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1056 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1057 ret->datalen = (*env)->GetArrayLength(env, elems);
1058 if (ret->datalen == 0) {
1061 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1062 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1063 for (size_t i = 0; i < ret->datalen; i++) {
1064 int64_t arr_elem = java_elems[i];
1065 LDKRouteHop arr_elem_conv;
1066 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1067 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1068 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1069 ret->data[i] = arr_elem_conv;
1071 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1073 return (uint64_t)ret;
1075 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1076 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1077 for (size_t i = 0; i < ret.datalen; i++) {
1078 ret.data[i] = RouteHop_clone(&orig->data[i]);
1082 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1083 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1084 for (size_t i = 0; i < ret.datalen; i++) {
1085 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1090 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1093 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1094 CHECK(val->result_ok);
1095 LDKRoute res_var = (*val->contents.result);
1096 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1097 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1098 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1102 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1103 CHECK(!val->result_ok);
1104 LDKDecodeError err_var = (*val->contents.err);
1105 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1106 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1107 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1110 static jclass LDKCOption_u64Z_Some_class = NULL;
1111 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1112 static jclass LDKCOption_u64Z_None_class = NULL;
1113 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1115 LDKCOption_u64Z_Some_class =
1116 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1117 CHECK(LDKCOption_u64Z_Some_class != NULL);
1118 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1119 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1120 LDKCOption_u64Z_None_class =
1121 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1122 CHECK(LDKCOption_u64Z_None_class != NULL);
1123 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1124 CHECK(LDKCOption_u64Z_None_meth != NULL);
1126 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1127 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1129 case LDKCOption_u64Z_Some: {
1130 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1132 case LDKCOption_u64Z_None: {
1133 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1139 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1140 ret->datalen = (*env)->GetArrayLength(env, elems);
1141 if (ret->datalen == 0) {
1144 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1145 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1146 for (size_t i = 0; i < ret->datalen; i++) {
1147 int64_t arr_elem = java_elems[i];
1148 LDKChannelDetails arr_elem_conv;
1149 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1150 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1151 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1152 ret->data[i] = arr_elem_conv;
1154 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1156 return (uint64_t)ret;
1158 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1159 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1160 for (size_t i = 0; i < ret.datalen; i++) {
1161 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1166 LDKCVec_RouteHintHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHintHopZ), "LDKCVec_RouteHintHopZ");
1167 ret->datalen = (*env)->GetArrayLength(env, elems);
1168 if (ret->datalen == 0) {
1171 ret->data = MALLOC(sizeof(LDKRouteHintHop) * ret->datalen, "LDKCVec_RouteHintHopZ Data");
1172 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1173 for (size_t i = 0; i < ret->datalen; i++) {
1174 int64_t arr_elem = java_elems[i];
1175 LDKRouteHintHop arr_elem_conv;
1176 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1177 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1178 arr_elem_conv = RouteHintHop_clone(&arr_elem_conv);
1179 ret->data[i] = arr_elem_conv;
1181 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1183 return (uint64_t)ret;
1185 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1186 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1187 for (size_t i = 0; i < ret.datalen; i++) {
1188 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1193 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1196 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1197 CHECK(val->result_ok);
1198 LDKRoute res_var = (*val->contents.result);
1199 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1200 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1201 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1205 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1206 CHECK(!val->result_ok);
1207 LDKLightningError err_var = (*val->contents.err);
1208 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1209 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1210 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1214 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1217 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1218 CHECK(val->result_ok);
1219 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1220 return (uint64_t)res_ref;
1222 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1223 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1224 CHECK(!val->result_ok);
1225 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1229 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1231 LDKTransaction b_ref;
1232 b_ref.datalen = (*env)->GetArrayLength(env, b);
1233 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1234 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1235 b_ref.data_is_owned = false;
1237 return (uint64_t)ret;
1239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1240 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1244 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1245 LDKTransaction b_var = tuple->b;
1246 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1247 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1251 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1252 ret->datalen = (*env)->GetArrayLength(env, elems);
1253 if (ret->datalen == 0) {
1256 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1257 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1258 for (size_t i = 0; i < ret->datalen; i++) {
1259 int64_t arr_elem = java_elems[i];
1260 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1261 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1262 ret->data[i] = arr_elem_conv;
1264 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1266 return (uint64_t)ret;
1268 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1269 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1270 for (size_t i = 0; i < ret.datalen; i++) {
1271 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1275 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1276 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1277 for (size_t i = 0; i < ret.datalen; i++) {
1278 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1283 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1286 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1287 CHECK(val->result_ok);
1288 return *val->contents.result;
1290 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1291 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1292 CHECK(!val->result_ok);
1293 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1296 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1297 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1298 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1299 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1301 LDKMonitorEvent_HTLCEvent_class =
1302 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1303 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1304 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1305 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1306 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1307 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1308 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1309 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
1310 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1312 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1313 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1315 case LDKMonitorEvent_HTLCEvent: {
1316 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1317 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1318 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1319 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1320 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1322 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1323 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1324 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1325 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1326 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
1327 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
1332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1333 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1334 ret->datalen = (*env)->GetArrayLength(env, elems);
1335 if (ret->datalen == 0) {
1338 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1339 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1340 for (size_t i = 0; i < ret->datalen; i++) {
1341 int64_t arr_elem = java_elems[i];
1342 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1343 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1344 ret->data[i] = arr_elem_conv;
1346 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1348 return (uint64_t)ret;
1350 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1351 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1352 for (size_t i = 0; i < ret.datalen; i++) {
1353 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1357 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1358 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1359 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1360 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1362 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1363 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1364 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1365 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1366 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1367 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1368 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1369 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1370 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1371 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1373 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1374 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1376 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1377 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1378 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1380 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1381 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1386 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1387 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1388 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1389 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1390 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1391 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1393 LDKSpendableOutputDescriptor_StaticOutput_class =
1394 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1395 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1396 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1397 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1398 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1399 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1400 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1401 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1402 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1403 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1404 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1405 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1406 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1407 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1409 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1410 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1412 case LDKSpendableOutputDescriptor_StaticOutput: {
1413 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1414 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1415 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1416 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1417 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1418 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1420 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1421 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1422 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1423 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1424 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1425 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1427 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1428 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1429 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1430 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1431 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1432 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1438 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1439 ret->datalen = (*env)->GetArrayLength(env, elems);
1440 if (ret->datalen == 0) {
1443 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1444 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1445 for (size_t i = 0; i < ret->datalen; i++) {
1446 int64_t arr_elem = java_elems[i];
1447 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1448 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1449 ret->data[i] = arr_elem_conv;
1451 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1453 return (uint64_t)ret;
1455 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1456 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1457 for (size_t i = 0; i < ret.datalen; i++) {
1458 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1462 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1463 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1464 static jclass LDKErrorAction_IgnoreError_class = NULL;
1465 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1466 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1467 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1469 LDKErrorAction_DisconnectPeer_class =
1470 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1471 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1472 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1473 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1474 LDKErrorAction_IgnoreError_class =
1475 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1476 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1477 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1478 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1479 LDKErrorAction_SendErrorMessage_class =
1480 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1481 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1482 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1483 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1485 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1486 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1488 case LDKErrorAction_DisconnectPeer: {
1489 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1490 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1491 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1492 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1493 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1495 case LDKErrorAction_IgnoreError: {
1496 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1498 case LDKErrorAction_SendErrorMessage: {
1499 LDKErrorMessage msg_var = obj->send_error_message.msg;
1500 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1501 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1502 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1503 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1508 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1509 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1510 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1511 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1512 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1513 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
1515 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1516 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1517 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1518 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1519 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1520 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1521 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1522 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1523 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1524 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1525 LDKHTLCFailChannelUpdate_NodeFailure_class =
1526 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1527 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1528 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1529 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1531 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1532 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1534 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1535 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1536 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1537 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1538 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1539 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1541 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1542 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1544 case LDKHTLCFailChannelUpdate_NodeFailure: {
1545 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1546 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1547 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1552 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1553 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1554 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1555 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1556 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1557 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1558 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1559 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1560 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1561 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1562 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1563 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1564 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1565 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1566 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1567 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1568 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1569 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1570 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1571 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1572 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1573 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1574 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1575 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1576 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1577 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1578 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1579 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1580 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1581 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1582 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1583 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1584 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1585 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1586 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1587 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1588 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1589 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1591 LDKMessageSendEvent_SendAcceptChannel_class =
1592 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1593 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1594 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1595 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1596 LDKMessageSendEvent_SendOpenChannel_class =
1597 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1598 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1599 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1600 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1601 LDKMessageSendEvent_SendFundingCreated_class =
1602 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1603 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1604 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1605 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1606 LDKMessageSendEvent_SendFundingSigned_class =
1607 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1608 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1609 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1610 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1611 LDKMessageSendEvent_SendFundingLocked_class =
1612 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1613 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1614 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1615 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1616 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1617 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1618 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1619 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1620 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1621 LDKMessageSendEvent_UpdateHTLCs_class =
1622 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1623 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1624 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1625 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1626 LDKMessageSendEvent_SendRevokeAndACK_class =
1627 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1628 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1629 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1630 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1631 LDKMessageSendEvent_SendClosingSigned_class =
1632 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1633 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1634 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1635 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1636 LDKMessageSendEvent_SendShutdown_class =
1637 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1638 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1639 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1640 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1641 LDKMessageSendEvent_SendChannelReestablish_class =
1642 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1643 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1644 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1645 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1646 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1647 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1648 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1649 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1650 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1651 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1652 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1653 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1654 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1655 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1656 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1657 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1658 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1659 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1660 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1661 LDKMessageSendEvent_HandleError_class =
1662 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1663 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1664 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1665 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1666 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1667 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1668 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1669 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1670 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1671 LDKMessageSendEvent_SendChannelRangeQuery_class =
1672 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1673 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1674 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1675 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1676 LDKMessageSendEvent_SendShortIdsQuery_class =
1677 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1678 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1679 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1680 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1681 LDKMessageSendEvent_SendReplyChannelRange_class =
1682 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1683 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1684 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1685 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1687 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1688 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1690 case LDKMessageSendEvent_SendAcceptChannel: {
1691 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1692 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1693 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1694 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1695 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1696 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1697 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1699 case LDKMessageSendEvent_SendOpenChannel: {
1700 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1701 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1702 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1703 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1704 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1705 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1706 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1708 case LDKMessageSendEvent_SendFundingCreated: {
1709 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1710 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1711 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1712 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1713 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1714 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1715 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1717 case LDKMessageSendEvent_SendFundingSigned: {
1718 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1719 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1720 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1721 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1722 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1723 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1724 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1726 case LDKMessageSendEvent_SendFundingLocked: {
1727 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1728 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1729 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1730 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1731 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1732 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1733 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1735 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1736 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1737 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1738 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1739 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1740 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1741 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1742 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1744 case LDKMessageSendEvent_UpdateHTLCs: {
1745 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1746 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1747 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1748 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1749 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1750 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1751 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1753 case LDKMessageSendEvent_SendRevokeAndACK: {
1754 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1755 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1756 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1757 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1758 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1759 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1760 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1762 case LDKMessageSendEvent_SendClosingSigned: {
1763 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1764 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1765 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1766 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1767 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1768 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1769 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1771 case LDKMessageSendEvent_SendShutdown: {
1772 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1773 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1774 LDKShutdown msg_var = obj->send_shutdown.msg;
1775 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1776 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1777 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1778 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1780 case LDKMessageSendEvent_SendChannelReestablish: {
1781 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1782 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1783 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1784 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1785 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1786 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1787 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1789 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1790 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1791 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1792 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1793 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1794 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1795 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1796 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1797 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1798 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1800 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1801 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1802 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1803 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1804 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1805 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1807 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1808 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1809 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1810 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1811 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1812 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1814 case LDKMessageSendEvent_HandleError: {
1815 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1816 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1817 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1818 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1820 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1821 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1822 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1824 case LDKMessageSendEvent_SendChannelRangeQuery: {
1825 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1826 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1827 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1828 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1829 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1830 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1831 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1833 case LDKMessageSendEvent_SendShortIdsQuery: {
1834 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1835 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1836 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1837 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1838 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1839 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1840 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1842 case LDKMessageSendEvent_SendReplyChannelRange: {
1843 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1844 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1845 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1846 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1847 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1848 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1849 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1855 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1856 ret->datalen = (*env)->GetArrayLength(env, elems);
1857 if (ret->datalen == 0) {
1860 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1861 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1862 for (size_t i = 0; i < ret->datalen; i++) {
1863 int64_t arr_elem = java_elems[i];
1864 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1865 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1866 ret->data[i] = arr_elem_conv;
1868 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1870 return (uint64_t)ret;
1872 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1873 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1874 for (size_t i = 0; i < ret.datalen; i++) {
1875 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1880 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1883 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1884 CHECK(val->result_ok);
1885 LDKInitFeatures res_var = (*val->contents.result);
1886 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1887 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1888 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1892 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1893 CHECK(!val->result_ok);
1894 LDKDecodeError err_var = (*val->contents.err);
1895 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1896 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1897 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1901 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1904 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1905 CHECK(val->result_ok);
1906 LDKNodeFeatures res_var = (*val->contents.result);
1907 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1908 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1909 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1913 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1914 CHECK(!val->result_ok);
1915 LDKDecodeError err_var = (*val->contents.err);
1916 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1917 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1918 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1922 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1925 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1926 CHECK(val->result_ok);
1927 LDKChannelFeatures res_var = (*val->contents.result);
1928 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1929 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1930 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1934 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1935 CHECK(!val->result_ok);
1936 LDKDecodeError err_var = (*val->contents.err);
1937 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1938 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1939 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1943 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1946 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1947 CHECK(val->result_ok);
1948 LDKInvoiceFeatures res_var = (*val->contents.result);
1949 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1950 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1951 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1955 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1956 CHECK(!val->result_ok);
1957 LDKDecodeError err_var = (*val->contents.err);
1958 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1959 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1960 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1964 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1967 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1968 CHECK(val->result_ok);
1969 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1970 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1971 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1972 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1976 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1977 CHECK(!val->result_ok);
1978 LDKDecodeError err_var = (*val->contents.err);
1979 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1980 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1981 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1985 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1988 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1989 CHECK(val->result_ok);
1990 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1991 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1992 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1993 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1997 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1998 CHECK(!val->result_ok);
1999 LDKDecodeError err_var = (*val->contents.err);
2000 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2001 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2002 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2006 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2009 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2010 CHECK(val->result_ok);
2011 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2015 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2016 CHECK(!val->result_ok);
2017 LDKDecodeError err_var = (*val->contents.err);
2018 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2019 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2020 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2024 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2026 CHECK((*env)->GetArrayLength(env, a) == 64);
2027 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2029 LDKCVec_SignatureZ b_constr;
2030 b_constr.datalen = (*env)->GetArrayLength(env, b);
2031 if (b_constr.datalen > 0)
2032 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2034 b_constr.data = NULL;
2035 for (size_t i = 0; i < b_constr.datalen; i++) {
2036 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2037 LDKSignature b_conv_8_ref;
2038 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2039 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2040 b_constr.data[i] = b_conv_8_ref;
2043 return (uint64_t)ret;
2045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2046 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2047 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2048 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2051 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2052 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2053 LDKCVec_SignatureZ b_var = tuple->b;
2054 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2056 for (size_t i = 0; i < b_var.datalen; i++) {
2057 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2058 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2059 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2064 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2067 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2068 CHECK(val->result_ok);
2069 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2073 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2074 CHECK(!val->result_ok);
2075 return *val->contents.err;
2077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2078 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2081 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2082 CHECK(val->result_ok);
2083 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2084 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2088 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2089 CHECK(!val->result_ok);
2090 return *val->contents.err;
2092 typedef struct LDKBaseSign_JCalls {
2093 atomic_size_t refcnt;
2096 jmethodID get_per_commitment_point_meth;
2097 jmethodID release_commitment_secret_meth;
2098 jmethodID channel_keys_id_meth;
2099 jmethodID sign_counterparty_commitment_meth;
2100 jmethodID sign_holder_commitment_and_htlcs_meth;
2101 jmethodID sign_justice_revoked_output_meth;
2102 jmethodID sign_justice_revoked_htlc_meth;
2103 jmethodID sign_counterparty_htlc_transaction_meth;
2104 jmethodID sign_closing_transaction_meth;
2105 jmethodID sign_channel_announcement_meth;
2106 jmethodID ready_channel_meth;
2107 } LDKBaseSign_JCalls;
2108 static void LDKBaseSign_JCalls_free(void* this_arg) {
2109 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2110 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2112 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2113 if (get_jenv_res == JNI_EDETACHED) {
2114 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2116 DO_ASSERT(get_jenv_res == JNI_OK);
2118 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2119 if (get_jenv_res == JNI_EDETACHED) {
2120 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2125 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2126 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2128 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2129 if (get_jenv_res == JNI_EDETACHED) {
2130 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2132 DO_ASSERT(get_jenv_res == JNI_OK);
2134 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2136 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2137 LDKPublicKey ret_ref;
2138 CHECK((*env)->GetArrayLength(env, ret) == 33);
2139 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2140 if (get_jenv_res == JNI_EDETACHED) {
2141 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2145 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2146 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2148 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2149 if (get_jenv_res == JNI_EDETACHED) {
2150 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2152 DO_ASSERT(get_jenv_res == JNI_OK);
2154 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2156 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2157 LDKThirtyTwoBytes ret_ref;
2158 CHECK((*env)->GetArrayLength(env, ret) == 32);
2159 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2160 if (get_jenv_res == JNI_EDETACHED) {
2161 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2165 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2166 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2168 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2169 if (get_jenv_res == JNI_EDETACHED) {
2170 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2172 DO_ASSERT(get_jenv_res == JNI_OK);
2174 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2176 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2177 LDKThirtyTwoBytes ret_ref;
2178 CHECK((*env)->GetArrayLength(env, ret) == 32);
2179 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2180 if (get_jenv_res == JNI_EDETACHED) {
2181 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2185 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2186 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2188 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2189 if (get_jenv_res == JNI_EDETACHED) {
2190 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2192 DO_ASSERT(get_jenv_res == JNI_OK);
2194 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2195 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2196 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2197 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2198 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2199 if (commitment_tx_var.is_owned) {
2200 commitment_tx_ref |= 1;
2202 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2204 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2205 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2206 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2207 if (get_jenv_res == JNI_EDETACHED) {
2208 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2212 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2213 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2215 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2216 if (get_jenv_res == JNI_EDETACHED) {
2217 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2219 DO_ASSERT(get_jenv_res == JNI_OK);
2221 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2222 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2223 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2224 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2225 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2226 if (commitment_tx_var.is_owned) {
2227 commitment_tx_ref |= 1;
2229 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2231 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2232 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2233 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2234 if (get_jenv_res == JNI_EDETACHED) {
2235 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2239 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]) {
2240 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2242 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2243 if (get_jenv_res == JNI_EDETACHED) {
2244 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2246 DO_ASSERT(get_jenv_res == JNI_OK);
2248 LDKTransaction justice_tx_var = justice_tx;
2249 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2250 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2251 Transaction_free(justice_tx_var);
2252 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2253 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2254 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2256 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2257 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2258 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2259 if (get_jenv_res == JNI_EDETACHED) {
2260 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2264 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) {
2265 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2267 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2268 if (get_jenv_res == JNI_EDETACHED) {
2269 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2271 DO_ASSERT(get_jenv_res == JNI_OK);
2273 LDKTransaction justice_tx_var = justice_tx;
2274 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2275 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2276 Transaction_free(justice_tx_var);
2277 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2278 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2279 LDKHTLCOutputInCommitment htlc_var = *htlc;
2280 htlc_var = HTLCOutputInCommitment_clone(htlc);
2281 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2282 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2283 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2284 if (htlc_var.is_owned) {
2287 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2289 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2290 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2291 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2292 if (get_jenv_res == JNI_EDETACHED) {
2293 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2297 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) {
2298 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2300 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2301 if (get_jenv_res == JNI_EDETACHED) {
2302 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2304 DO_ASSERT(get_jenv_res == JNI_OK);
2306 LDKTransaction htlc_tx_var = htlc_tx;
2307 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2308 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2309 Transaction_free(htlc_tx_var);
2310 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2311 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2312 LDKHTLCOutputInCommitment htlc_var = *htlc;
2313 htlc_var = HTLCOutputInCommitment_clone(htlc);
2314 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2315 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2316 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2317 if (htlc_var.is_owned) {
2320 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2322 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2323 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2324 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2325 if (get_jenv_res == JNI_EDETACHED) {
2326 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2330 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2331 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2333 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2334 if (get_jenv_res == JNI_EDETACHED) {
2335 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2337 DO_ASSERT(get_jenv_res == JNI_OK);
2339 LDKTransaction closing_tx_var = closing_tx;
2340 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2341 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2342 Transaction_free(closing_tx_var);
2343 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2345 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2346 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2347 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2348 if (get_jenv_res == JNI_EDETACHED) {
2349 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2353 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2354 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2356 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2357 if (get_jenv_res == JNI_EDETACHED) {
2358 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2360 DO_ASSERT(get_jenv_res == JNI_OK);
2362 LDKUnsignedChannelAnnouncement msg_var = *msg;
2363 msg_var = UnsignedChannelAnnouncement_clone(msg);
2364 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2365 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2366 uint64_t msg_ref = (uint64_t)msg_var.inner;
2367 if (msg_var.is_owned) {
2370 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2372 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2373 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2374 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2375 if (get_jenv_res == JNI_EDETACHED) {
2376 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2380 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2381 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2383 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2384 if (get_jenv_res == JNI_EDETACHED) {
2385 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2387 DO_ASSERT(get_jenv_res == JNI_OK);
2389 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2390 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2391 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2392 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2393 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2394 if (channel_parameters_var.is_owned) {
2395 channel_parameters_ref |= 1;
2397 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2399 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2400 if (get_jenv_res == JNI_EDETACHED) {
2401 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2404 static void* LDKBaseSign_JCalls_clone(const void* this_arg) {
2405 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2406 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2407 return (void*) this_arg;
2409 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2410 jclass c = (*env)->GetObjectClass(env, o);
2412 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2413 atomic_init(&calls->refcnt, 1);
2414 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2415 calls->o = (*env)->NewWeakGlobalRef(env, o);
2416 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2417 CHECK(calls->get_per_commitment_point_meth != NULL);
2418 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2419 CHECK(calls->release_commitment_secret_meth != NULL);
2420 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2421 CHECK(calls->channel_keys_id_meth != NULL);
2422 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2423 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2424 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2425 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2426 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2427 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2428 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2429 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2430 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2431 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2432 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2433 CHECK(calls->sign_closing_transaction_meth != NULL);
2434 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2435 CHECK(calls->sign_channel_announcement_meth != NULL);
2436 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2437 CHECK(calls->ready_channel_meth != NULL);
2439 LDKChannelPublicKeys pubkeys_conv;
2440 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2441 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2442 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2445 .this_arg = (void*) calls,
2446 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2447 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2448 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2449 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2450 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2451 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2452 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2453 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2454 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2455 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2456 .ready_channel = ready_channel_LDKBaseSign_jcall,
2457 .free = LDKBaseSign_JCalls_free,
2458 .pubkeys = pubkeys_conv,
2459 .set_pubkeys = NULL,
2463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2464 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2465 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2466 return (uint64_t)res_ptr;
2468 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) {
2469 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2470 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2471 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2475 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2476 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2477 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2478 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2483 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2484 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2485 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2489 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) {
2490 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2491 LDKCommitmentTransaction commitment_tx_conv;
2492 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2493 commitment_tx_conv.is_owned = false;
2494 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2495 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2496 return (uint64_t)ret_conv;
2499 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) {
2500 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2501 LDKHolderCommitmentTransaction commitment_tx_conv;
2502 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2503 commitment_tx_conv.is_owned = false;
2504 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2505 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2506 return (uint64_t)ret_conv;
2509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
2510 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2511 LDKTransaction justice_tx_ref;
2512 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2513 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2514 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2515 justice_tx_ref.data_is_owned = true;
2516 unsigned char per_commitment_key_arr[32];
2517 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2518 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2519 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2520 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2521 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2522 return (uint64_t)ret_conv;
2525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
2526 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2527 LDKTransaction justice_tx_ref;
2528 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2529 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2530 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2531 justice_tx_ref.data_is_owned = true;
2532 unsigned char per_commitment_key_arr[32];
2533 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2534 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2535 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2536 LDKHTLCOutputInCommitment htlc_conv;
2537 htlc_conv.inner = (void*)(htlc & (~1));
2538 htlc_conv.is_owned = false;
2539 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2540 *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);
2541 return (uint64_t)ret_conv;
2544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
2545 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2546 LDKTransaction htlc_tx_ref;
2547 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2548 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2549 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2550 htlc_tx_ref.data_is_owned = true;
2551 LDKPublicKey per_commitment_point_ref;
2552 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2553 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2554 LDKHTLCOutputInCommitment htlc_conv;
2555 htlc_conv.inner = (void*)(htlc & (~1));
2556 htlc_conv.is_owned = false;
2557 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2558 *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);
2559 return (uint64_t)ret_conv;
2562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
2563 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2564 LDKTransaction closing_tx_ref;
2565 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2566 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2567 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2568 closing_tx_ref.data_is_owned = true;
2569 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2570 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2571 return (uint64_t)ret_conv;
2574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2575 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2576 LDKUnsignedChannelAnnouncement msg_conv;
2577 msg_conv.inner = (void*)(msg & (~1));
2578 msg_conv.is_owned = false;
2579 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2580 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2581 return (uint64_t)ret_conv;
2584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2585 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2586 LDKChannelTransactionParameters channel_parameters_conv;
2587 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2588 channel_parameters_conv.is_owned = false;
2589 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2592 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2593 if (this_arg->set_pubkeys != NULL)
2594 this_arg->set_pubkeys(this_arg);
2595 return this_arg->pubkeys;
2597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2598 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2599 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2602 uint64_t ret_ref = (uint64_t)ret_var.inner;
2603 if (ret_var.is_owned) {
2609 typedef struct LDKSign_JCalls {
2610 atomic_size_t refcnt;
2613 LDKBaseSign_JCalls* BaseSign;
2614 jmethodID write_meth;
2616 static void LDKSign_JCalls_free(void* this_arg) {
2617 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2618 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2620 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2621 if (get_jenv_res == JNI_EDETACHED) {
2622 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2624 DO_ASSERT(get_jenv_res == JNI_OK);
2626 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2627 if (get_jenv_res == JNI_EDETACHED) {
2628 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2633 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2634 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2636 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2637 if (get_jenv_res == JNI_EDETACHED) {
2638 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2640 DO_ASSERT(get_jenv_res == JNI_OK);
2642 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2644 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2645 LDKCVec_u8Z ret_ref;
2646 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2647 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2648 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2649 if (get_jenv_res == JNI_EDETACHED) {
2650 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2654 static void* LDKSign_JCalls_clone(const void* this_arg) {
2655 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2656 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2657 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2658 return (void*) this_arg;
2660 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2661 jclass c = (*env)->GetObjectClass(env, o);
2663 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2664 atomic_init(&calls->refcnt, 1);
2665 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2666 calls->o = (*env)->NewWeakGlobalRef(env, o);
2667 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2668 CHECK(calls->write_meth != NULL);
2670 LDKChannelPublicKeys pubkeys_conv;
2671 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2672 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2673 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2676 .this_arg = (void*) calls,
2677 .write = write_LDKSign_jcall,
2678 .clone = LDKSign_JCalls_clone,
2679 .free = LDKSign_JCalls_free,
2680 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2682 calls->BaseSign = ret.BaseSign.this_arg;
2685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2686 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2687 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2688 return (uint64_t)res_ptr;
2690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2691 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2692 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2693 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2694 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2695 CVec_u8Z_free(ret_var);
2699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2700 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2703 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2704 CHECK(val->result_ok);
2705 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2706 *ret = Sign_clone(&(*val->contents.result));
2707 return (uint64_t)ret;
2709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2710 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2711 CHECK(!val->result_ok);
2712 LDKDecodeError err_var = (*val->contents.err);
2713 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2714 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2715 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2719 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2722 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2723 CHECK(val->result_ok);
2724 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
2725 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
2728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2729 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2730 CHECK(!val->result_ok);
2731 return *val->contents.err;
2733 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2734 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2735 for (size_t i = 0; i < ret.datalen; i++) {
2736 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2741 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2743 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2744 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2745 CHECK(val->result_ok);
2746 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2747 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
2749 for (size_t i = 0; i < res_var.datalen; i++) {
2750 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
2751 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
2752 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
2753 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
2757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2758 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2759 CHECK(!val->result_ok);
2760 return *val->contents.err;
2762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2763 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2766 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2767 CHECK(val->result_ok);
2768 LDKInMemorySigner res_var = (*val->contents.result);
2769 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2770 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2771 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2775 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2776 CHECK(!val->result_ok);
2777 LDKDecodeError err_var = (*val->contents.err);
2778 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2779 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2780 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2784 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2785 ret->datalen = (*env)->GetArrayLength(env, elems);
2786 if (ret->datalen == 0) {
2789 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2790 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2791 for (size_t i = 0; i < ret->datalen; i++) {
2792 int64_t arr_elem = java_elems[i];
2793 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2794 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2795 ret->data[i] = arr_elem_conv;
2797 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2799 return (uint64_t)ret;
2801 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2802 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2803 for (size_t i = 0; i < ret.datalen; i++) {
2804 ret.data[i] = TxOut_clone(&orig->data[i]);
2808 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2809 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2811 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2812 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2813 CHECK(val->result_ok);
2814 LDKTransaction res_var = (*val->contents.result);
2815 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
2816 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
2819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2820 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2821 CHECK(!val->result_ok);
2822 return *val->contents.err;
2824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2825 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2826 LDKThirtyTwoBytes a_ref;
2827 CHECK((*env)->GetArrayLength(env, a) == 32);
2828 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2830 LDKChannelMonitor b_conv;
2831 b_conv.inner = (void*)(b & (~1));
2832 b_conv.is_owned = (b & 1) || (b == 0);
2833 b_conv = ChannelMonitor_clone(&b_conv);
2835 return (uint64_t)ret;
2837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2838 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2839 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2840 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2844 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2845 LDKChannelMonitor b_var = tuple->b;
2846 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2847 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2848 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2852 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2853 ret->datalen = (*env)->GetArrayLength(env, elems);
2854 if (ret->datalen == 0) {
2857 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2858 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2859 for (size_t i = 0; i < ret->datalen; i++) {
2860 int64_t arr_elem = java_elems[i];
2861 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2862 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2863 ret->data[i] = arr_elem_conv;
2865 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2867 return (uint64_t)ret;
2869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2870 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2872 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2873 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2874 CHECK(val->result_ok);
2875 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2876 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
2877 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
2878 for (size_t i = 0; i < res_var.datalen; i++) {
2879 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
2880 res_arr_ptr[i] = res_conv_34_ref;
2882 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
2885 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2886 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2887 CHECK(!val->result_ok);
2888 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
2891 static jclass LDKAPIError_APIMisuseError_class = NULL;
2892 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2893 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2894 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2895 static jclass LDKAPIError_RouteError_class = NULL;
2896 static jmethodID LDKAPIError_RouteError_meth = NULL;
2897 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2898 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2899 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2900 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2902 LDKAPIError_APIMisuseError_class =
2903 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2904 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2905 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
2906 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2907 LDKAPIError_FeeRateTooHigh_class =
2908 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2909 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2910 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
2911 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2912 LDKAPIError_RouteError_class =
2913 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2914 CHECK(LDKAPIError_RouteError_class != NULL);
2915 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2916 CHECK(LDKAPIError_RouteError_meth != NULL);
2917 LDKAPIError_ChannelUnavailable_class =
2918 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2919 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2920 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
2921 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2922 LDKAPIError_MonitorUpdateFailed_class =
2923 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2924 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2925 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2926 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2928 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2929 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2931 case LDKAPIError_APIMisuseError: {
2932 LDKStr err_str = obj->api_misuse_error.err;
2933 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2934 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
2936 case LDKAPIError_FeeRateTooHigh: {
2937 LDKStr err_str = obj->fee_rate_too_high.err;
2938 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2939 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
2941 case LDKAPIError_RouteError: {
2942 LDKStr err_str = obj->route_error.err;
2943 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2944 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2946 case LDKAPIError_ChannelUnavailable: {
2947 LDKStr err_str = obj->channel_unavailable.err;
2948 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2949 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
2951 case LDKAPIError_MonitorUpdateFailed: {
2952 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2958 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2961 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2962 CHECK(val->result_ok);
2963 return *val->contents.result;
2965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2966 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2967 CHECK(!val->result_ok);
2968 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2972 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2973 ret->datalen = (*env)->GetArrayLength(env, elems);
2974 if (ret->datalen == 0) {
2977 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2978 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2979 for (size_t i = 0; i < ret->datalen; i++) {
2980 int64_t arr_elem = java_elems[i];
2981 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2982 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2983 ret->data[i] = arr_elem_conv;
2985 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2987 return (uint64_t)ret;
2989 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2990 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2991 for (size_t i = 0; i < ret.datalen; i++) {
2992 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2997 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2998 ret->datalen = (*env)->GetArrayLength(env, elems);
2999 if (ret->datalen == 0) {
3002 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3003 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3004 for (size_t i = 0; i < ret->datalen; i++) {
3005 int64_t arr_elem = java_elems[i];
3006 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3007 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3008 ret->data[i] = arr_elem_conv;
3010 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3012 return (uint64_t)ret;
3014 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3015 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3016 for (size_t i = 0; i < ret.datalen; i++) {
3017 ret.data[i] = APIError_clone(&orig->data[i]);
3021 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3022 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3023 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3024 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3025 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3026 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3027 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3028 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3030 LDKPaymentSendFailure_ParameterError_class =
3031 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3032 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3033 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3034 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3035 LDKPaymentSendFailure_PathParameterError_class =
3036 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3037 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3038 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3039 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3040 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3041 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3042 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3043 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3044 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3045 LDKPaymentSendFailure_PartialFailure_class =
3046 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3047 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3048 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3049 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3051 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3052 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3054 case LDKPaymentSendFailure_ParameterError: {
3055 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3056 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3058 case LDKPaymentSendFailure_PathParameterError: {
3059 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3060 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3061 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3062 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3063 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3064 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3065 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3066 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3068 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3069 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3071 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3072 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3073 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3074 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3075 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3076 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3077 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3079 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3080 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3082 case LDKPaymentSendFailure_PartialFailure: {
3083 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3084 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3085 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3086 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3087 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3088 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3089 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3090 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3092 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3093 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3099 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3102 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3103 CHECK(val->result_ok);
3104 return *val->contents.result;
3106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3107 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3108 CHECK(!val->result_ok);
3109 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3112 static jclass LDKNetAddress_IPv4_class = NULL;
3113 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3114 static jclass LDKNetAddress_IPv6_class = NULL;
3115 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3116 static jclass LDKNetAddress_OnionV2_class = NULL;
3117 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3118 static jclass LDKNetAddress_OnionV3_class = NULL;
3119 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3121 LDKNetAddress_IPv4_class =
3122 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3123 CHECK(LDKNetAddress_IPv4_class != NULL);
3124 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3125 CHECK(LDKNetAddress_IPv4_meth != NULL);
3126 LDKNetAddress_IPv6_class =
3127 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3128 CHECK(LDKNetAddress_IPv6_class != NULL);
3129 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3130 CHECK(LDKNetAddress_IPv6_meth != NULL);
3131 LDKNetAddress_OnionV2_class =
3132 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3133 CHECK(LDKNetAddress_OnionV2_class != NULL);
3134 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3135 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3136 LDKNetAddress_OnionV3_class =
3137 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3138 CHECK(LDKNetAddress_OnionV3_class != NULL);
3139 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3140 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3142 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3143 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3145 case LDKNetAddress_IPv4: {
3146 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3147 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3148 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3150 case LDKNetAddress_IPv6: {
3151 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3152 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3153 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3155 case LDKNetAddress_OnionV2: {
3156 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3157 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3158 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3160 case LDKNetAddress_OnionV3: {
3161 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3162 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3163 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);
3168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3169 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3170 ret->datalen = (*env)->GetArrayLength(env, elems);
3171 if (ret->datalen == 0) {
3174 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3175 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3176 for (size_t i = 0; i < ret->datalen; i++) {
3177 int64_t arr_elem = java_elems[i];
3178 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3179 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3180 ret->data[i] = arr_elem_conv;
3182 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3184 return (uint64_t)ret;
3186 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3187 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3188 for (size_t i = 0; i < ret.datalen; i++) {
3189 ret.data[i] = NetAddress_clone(&orig->data[i]);
3193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3194 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3195 LDKThirtyTwoBytes a_ref;
3196 CHECK((*env)->GetArrayLength(env, a) == 32);
3197 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3199 LDKThirtyTwoBytes b_ref;
3200 CHECK((*env)->GetArrayLength(env, b) == 32);
3201 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3203 return (uint64_t)ret;
3205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3206 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3207 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3208 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3212 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3213 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3214 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3218 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3220 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3221 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3222 CHECK(val->result_ok);
3223 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3224 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3228 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3229 CHECK(!val->result_ok);
3230 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3234 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3235 ret->datalen = (*env)->GetArrayLength(env, elems);
3236 if (ret->datalen == 0) {
3239 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3240 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3241 for (size_t i = 0; i < ret->datalen; i++) {
3242 int64_t arr_elem = java_elems[i];
3243 LDKChannelMonitor arr_elem_conv;
3244 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3245 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3246 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3247 ret->data[i] = arr_elem_conv;
3249 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3251 return (uint64_t)ret;
3253 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3254 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3255 for (size_t i = 0; i < ret.datalen; i++) {
3256 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3260 typedef struct LDKWatch_JCalls {
3261 atomic_size_t refcnt;
3264 jmethodID watch_channel_meth;
3265 jmethodID update_channel_meth;
3266 jmethodID release_pending_monitor_events_meth;
3268 static void LDKWatch_JCalls_free(void* this_arg) {
3269 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3270 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3272 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3273 if (get_jenv_res == JNI_EDETACHED) {
3274 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3276 DO_ASSERT(get_jenv_res == JNI_OK);
3278 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3279 if (get_jenv_res == JNI_EDETACHED) {
3280 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3285 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3286 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3288 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3289 if (get_jenv_res == JNI_EDETACHED) {
3290 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3292 DO_ASSERT(get_jenv_res == JNI_OK);
3294 LDKOutPoint funding_txo_var = funding_txo;
3295 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3296 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3297 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3298 if (funding_txo_var.is_owned) {
3299 funding_txo_ref |= 1;
3301 LDKChannelMonitor monitor_var = monitor;
3302 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3303 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3304 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3305 if (monitor_var.is_owned) {
3308 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3310 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3311 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3312 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3313 if (get_jenv_res == JNI_EDETACHED) {
3314 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3318 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3319 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3321 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3322 if (get_jenv_res == JNI_EDETACHED) {
3323 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3325 DO_ASSERT(get_jenv_res == JNI_OK);
3327 LDKOutPoint funding_txo_var = funding_txo;
3328 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3329 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3330 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3331 if (funding_txo_var.is_owned) {
3332 funding_txo_ref |= 1;
3334 LDKChannelMonitorUpdate update_var = update;
3335 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3336 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3337 uint64_t update_ref = (uint64_t)update_var.inner;
3338 if (update_var.is_owned) {
3341 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3343 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3344 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3345 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3346 if (get_jenv_res == JNI_EDETACHED) {
3347 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3351 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3352 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3354 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3355 if (get_jenv_res == JNI_EDETACHED) {
3356 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3358 DO_ASSERT(get_jenv_res == JNI_OK);
3360 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3362 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3363 LDKCVec_MonitorEventZ ret_constr;
3364 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3365 if (ret_constr.datalen > 0)
3366 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3368 ret_constr.data = NULL;
3369 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3370 for (size_t o = 0; o < ret_constr.datalen; o++) {
3371 int64_t ret_conv_14 = ret_vals[o];
3372 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3373 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3374 ret_constr.data[o] = ret_conv_14_conv;
3376 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3377 if (get_jenv_res == JNI_EDETACHED) {
3378 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3382 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3383 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3384 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3385 return (void*) this_arg;
3387 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3388 jclass c = (*env)->GetObjectClass(env, o);
3390 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3391 atomic_init(&calls->refcnt, 1);
3392 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3393 calls->o = (*env)->NewWeakGlobalRef(env, o);
3394 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3395 CHECK(calls->watch_channel_meth != NULL);
3396 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3397 CHECK(calls->update_channel_meth != NULL);
3398 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3399 CHECK(calls->release_pending_monitor_events_meth != NULL);
3402 .this_arg = (void*) calls,
3403 .watch_channel = watch_channel_LDKWatch_jcall,
3404 .update_channel = update_channel_LDKWatch_jcall,
3405 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3406 .free = LDKWatch_JCalls_free,
3410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3411 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3412 *res_ptr = LDKWatch_init(env, clz, o);
3413 return (uint64_t)res_ptr;
3415 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) {
3416 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3417 LDKOutPoint funding_txo_conv;
3418 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3419 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3420 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3421 LDKChannelMonitor monitor_conv;
3422 monitor_conv.inner = (void*)(monitor & (~1));
3423 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3424 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3425 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3426 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3427 return (uint64_t)ret_conv;
3430 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) {
3431 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3432 LDKOutPoint funding_txo_conv;
3433 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3434 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3435 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3436 LDKChannelMonitorUpdate update_conv;
3437 update_conv.inner = (void*)(update & (~1));
3438 update_conv.is_owned = (update & 1) || (update == 0);
3439 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3440 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3441 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3442 return (uint64_t)ret_conv;
3445 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3446 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3447 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3448 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3449 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3450 for (size_t o = 0; o < ret_var.datalen; o++) {
3451 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3452 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3453 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3454 ret_arr_ptr[o] = ret_conv_14_ref;
3456 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3461 typedef struct LDKBroadcasterInterface_JCalls {
3462 atomic_size_t refcnt;
3465 jmethodID broadcast_transaction_meth;
3466 } LDKBroadcasterInterface_JCalls;
3467 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3468 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3469 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3471 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3472 if (get_jenv_res == JNI_EDETACHED) {
3473 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3475 DO_ASSERT(get_jenv_res == JNI_OK);
3477 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3478 if (get_jenv_res == JNI_EDETACHED) {
3479 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3484 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3485 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3487 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3488 if (get_jenv_res == JNI_EDETACHED) {
3489 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3491 DO_ASSERT(get_jenv_res == JNI_OK);
3493 LDKTransaction tx_var = tx;
3494 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3495 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3496 Transaction_free(tx_var);
3497 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3499 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3500 if (get_jenv_res == JNI_EDETACHED) {
3501 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3504 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3505 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3506 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3507 return (void*) this_arg;
3509 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3510 jclass c = (*env)->GetObjectClass(env, o);
3512 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3513 atomic_init(&calls->refcnt, 1);
3514 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3515 calls->o = (*env)->NewWeakGlobalRef(env, o);
3516 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3517 CHECK(calls->broadcast_transaction_meth != NULL);
3519 LDKBroadcasterInterface ret = {
3520 .this_arg = (void*) calls,
3521 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3522 .free = LDKBroadcasterInterface_JCalls_free,
3526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3527 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3528 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3529 return (uint64_t)res_ptr;
3531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3532 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3533 LDKTransaction tx_ref;
3534 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3535 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3536 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3537 tx_ref.data_is_owned = true;
3538 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3541 typedef struct LDKKeysInterface_JCalls {
3542 atomic_size_t refcnt;
3545 jmethodID get_node_secret_meth;
3546 jmethodID get_destination_script_meth;
3547 jmethodID get_shutdown_pubkey_meth;
3548 jmethodID get_channel_signer_meth;
3549 jmethodID get_secure_random_bytes_meth;
3550 jmethodID read_chan_signer_meth;
3551 jmethodID sign_invoice_meth;
3552 } LDKKeysInterface_JCalls;
3553 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3554 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3555 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3557 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3558 if (get_jenv_res == JNI_EDETACHED) {
3559 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3561 DO_ASSERT(get_jenv_res == JNI_OK);
3563 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3564 if (get_jenv_res == JNI_EDETACHED) {
3565 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3570 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3571 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3573 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3574 if (get_jenv_res == JNI_EDETACHED) {
3575 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3577 DO_ASSERT(get_jenv_res == JNI_OK);
3579 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3581 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3582 LDKSecretKey ret_ref;
3583 CHECK((*env)->GetArrayLength(env, ret) == 32);
3584 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3585 if (get_jenv_res == JNI_EDETACHED) {
3586 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3590 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3591 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3593 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3594 if (get_jenv_res == JNI_EDETACHED) {
3595 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3597 DO_ASSERT(get_jenv_res == JNI_OK);
3599 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3601 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3602 LDKCVec_u8Z ret_ref;
3603 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3604 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3605 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3606 if (get_jenv_res == JNI_EDETACHED) {
3607 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3611 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3612 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3614 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3615 if (get_jenv_res == JNI_EDETACHED) {
3616 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3618 DO_ASSERT(get_jenv_res == JNI_OK);
3620 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3622 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3623 LDKPublicKey ret_ref;
3624 CHECK((*env)->GetArrayLength(env, ret) == 33);
3625 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3626 if (get_jenv_res == JNI_EDETACHED) {
3627 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3631 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3632 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3634 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3635 if (get_jenv_res == JNI_EDETACHED) {
3636 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3638 DO_ASSERT(get_jenv_res == JNI_OK);
3640 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3642 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3643 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3644 ret_conv = Sign_clone(ret);
3645 if (get_jenv_res == JNI_EDETACHED) {
3646 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3650 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3651 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3653 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3654 if (get_jenv_res == JNI_EDETACHED) {
3655 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3657 DO_ASSERT(get_jenv_res == JNI_OK);
3659 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3661 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3662 LDKThirtyTwoBytes ret_ref;
3663 CHECK((*env)->GetArrayLength(env, ret) == 32);
3664 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3665 if (get_jenv_res == JNI_EDETACHED) {
3666 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3670 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3671 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3673 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3674 if (get_jenv_res == JNI_EDETACHED) {
3675 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3677 DO_ASSERT(get_jenv_res == JNI_OK);
3679 LDKu8slice reader_var = reader;
3680 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3681 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3682 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3684 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3685 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3686 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3687 if (get_jenv_res == JNI_EDETACHED) {
3688 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3692 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3693 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3695 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3696 if (get_jenv_res == JNI_EDETACHED) {
3697 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3699 DO_ASSERT(get_jenv_res == JNI_OK);
3701 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3702 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
3703 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
3704 CVec_u8Z_free(invoice_preimage_var);
3705 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3707 LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
3708 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
3709 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
3710 if (get_jenv_res == JNI_EDETACHED) {
3711 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3715 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3716 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3717 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3718 return (void*) this_arg;
3720 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3721 jclass c = (*env)->GetObjectClass(env, o);
3723 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3724 atomic_init(&calls->refcnt, 1);
3725 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3726 calls->o = (*env)->NewWeakGlobalRef(env, o);
3727 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3728 CHECK(calls->get_node_secret_meth != NULL);
3729 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3730 CHECK(calls->get_destination_script_meth != NULL);
3731 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3732 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3733 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3734 CHECK(calls->get_channel_signer_meth != NULL);
3735 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3736 CHECK(calls->get_secure_random_bytes_meth != NULL);
3737 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3738 CHECK(calls->read_chan_signer_meth != NULL);
3739 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
3740 CHECK(calls->sign_invoice_meth != NULL);
3742 LDKKeysInterface ret = {
3743 .this_arg = (void*) calls,
3744 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3745 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3746 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
3747 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3748 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3749 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3750 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3751 .free = LDKKeysInterface_JCalls_free,
3755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3756 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3757 *res_ptr = LDKKeysInterface_init(env, clz, o);
3758 return (uint64_t)res_ptr;
3760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3761 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3762 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3763 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3768 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3769 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3770 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3771 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3772 CVec_u8Z_free(ret_var);
3776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
3777 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3778 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3779 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3783 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) {
3784 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3785 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3786 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3787 return (uint64_t)ret;
3790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3791 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3792 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3793 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3798 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3799 LDKu8slice reader_ref;
3800 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3801 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3802 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3803 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3804 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3805 return (uint64_t)ret_conv;
3808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
3809 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3810 LDKCVec_u8Z invoice_preimage_ref;
3811 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
3812 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3813 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
3814 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3815 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3816 return (uint64_t)ret_conv;
3819 typedef struct LDKFeeEstimator_JCalls {
3820 atomic_size_t refcnt;
3823 jmethodID get_est_sat_per_1000_weight_meth;
3824 } LDKFeeEstimator_JCalls;
3825 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3826 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3827 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3829 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3830 if (get_jenv_res == JNI_EDETACHED) {
3831 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3833 DO_ASSERT(get_jenv_res == JNI_OK);
3835 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3836 if (get_jenv_res == JNI_EDETACHED) {
3837 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3842 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3843 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3845 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3846 if (get_jenv_res == JNI_EDETACHED) {
3847 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3849 DO_ASSERT(get_jenv_res == JNI_OK);
3851 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3852 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3854 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3855 if (get_jenv_res == JNI_EDETACHED) {
3856 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3860 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3861 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3862 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3863 return (void*) this_arg;
3865 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3866 jclass c = (*env)->GetObjectClass(env, o);
3868 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3869 atomic_init(&calls->refcnt, 1);
3870 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3871 calls->o = (*env)->NewWeakGlobalRef(env, o);
3872 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
3873 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3875 LDKFeeEstimator ret = {
3876 .this_arg = (void*) calls,
3877 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3878 .free = LDKFeeEstimator_JCalls_free,
3882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3883 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3884 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3885 return (uint64_t)res_ptr;
3887 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) {
3888 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3889 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3890 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3894 typedef struct LDKLogger_JCalls {
3895 atomic_size_t refcnt;
3900 static void LDKLogger_JCalls_free(void* this_arg) {
3901 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3902 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3904 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3905 if (get_jenv_res == JNI_EDETACHED) {
3906 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3908 DO_ASSERT(get_jenv_res == JNI_OK);
3910 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3911 if (get_jenv_res == JNI_EDETACHED) {
3912 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3917 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3918 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3920 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3921 if (get_jenv_res == JNI_EDETACHED) {
3922 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3924 DO_ASSERT(get_jenv_res == JNI_OK);
3926 const char* record_str = record;
3927 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
3928 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3930 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
3931 if (get_jenv_res == JNI_EDETACHED) {
3932 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3935 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3936 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3937 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3938 return (void*) this_arg;
3940 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3941 jclass c = (*env)->GetObjectClass(env, o);
3943 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3944 atomic_init(&calls->refcnt, 1);
3945 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3946 calls->o = (*env)->NewWeakGlobalRef(env, o);
3947 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
3948 CHECK(calls->log_meth != NULL);
3951 .this_arg = (void*) calls,
3952 .log = log_LDKLogger_jcall,
3953 .free = LDKLogger_JCalls_free,
3957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3958 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3959 *res_ptr = LDKLogger_init(env, clz, o);
3960 return (uint64_t)res_ptr;
3962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3963 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3964 LDKThirtyTwoBytes a_ref;
3965 CHECK((*env)->GetArrayLength(env, a) == 32);
3966 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3968 LDKChannelManager b_conv;
3969 b_conv.inner = (void*)(b & (~1));
3970 b_conv.is_owned = (b & 1) || (b == 0);
3971 // Warning: we need a move here but no clone is available for LDKChannelManager
3973 return (uint64_t)ret;
3975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3976 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3977 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3978 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3982 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3983 LDKChannelManager b_var = tuple->b;
3984 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3985 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3986 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3990 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3993 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3994 CHECK(val->result_ok);
3995 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
3998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3999 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4000 CHECK(!val->result_ok);
4001 LDKDecodeError err_var = (*val->contents.err);
4002 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4003 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4004 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4008 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4011 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4012 CHECK(val->result_ok);
4013 LDKChannelConfig res_var = (*val->contents.result);
4014 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4015 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4016 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4020 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4021 CHECK(!val->result_ok);
4022 LDKDecodeError err_var = (*val->contents.err);
4023 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4024 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4025 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4029 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4032 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4033 CHECK(val->result_ok);
4034 LDKOutPoint res_var = (*val->contents.result);
4035 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4036 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4037 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4041 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4042 CHECK(!val->result_ok);
4043 LDKDecodeError err_var = (*val->contents.err);
4044 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4045 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4046 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4050 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4052 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4053 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4054 CHECK(val->result_ok);
4055 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4059 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4060 CHECK(!val->result_ok);
4061 return *val->contents.err;
4063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4064 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4067 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4068 CHECK(val->result_ok);
4069 LDKInvoice res_var = (*val->contents.result);
4070 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4071 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4072 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4076 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4077 CHECK(!val->result_ok);
4078 return *val->contents.err;
4080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4081 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4084 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4085 CHECK(val->result_ok);
4086 LDKSignedRawInvoice res_var = (*val->contents.result);
4087 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4088 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4089 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4093 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4094 CHECK(!val->result_ok);
4095 return *val->contents.err;
4097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
4098 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4099 LDKRawInvoice a_conv;
4100 a_conv.inner = (void*)(a & (~1));
4101 a_conv.is_owned = (a & 1) || (a == 0);
4102 a_conv = RawInvoice_clone(&a_conv);
4104 LDKThirtyTwoBytes b_ref;
4105 CHECK((*env)->GetArrayLength(env, b) == 32);
4106 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4108 LDKInvoiceSignature c_conv;
4109 c_conv.inner = (void*)(c & (~1));
4110 c_conv.is_owned = (c & 1) || (c == 0);
4111 c_conv = InvoiceSignature_clone(&c_conv);
4113 return (uint64_t)ret;
4115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4116 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4117 LDKRawInvoice a_var = tuple->a;
4118 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4119 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4120 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4124 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4125 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4126 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4130 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4131 LDKInvoiceSignature c_var = tuple->c;
4132 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4133 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4134 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4138 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4141 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4142 CHECK(val->result_ok);
4143 LDKPayeePubKey res_var = (*val->contents.result);
4144 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4145 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4146 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4149 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4150 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4151 CHECK(!val->result_ok);
4152 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4156 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
4157 ret->datalen = (*env)->GetArrayLength(env, elems);
4158 if (ret->datalen == 0) {
4161 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
4162 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4163 for (size_t i = 0; i < ret->datalen; i++) {
4164 int64_t arr_elem = java_elems[i];
4165 LDKRouteHint arr_elem_conv;
4166 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4167 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4168 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4169 ret->data[i] = arr_elem_conv;
4171 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4173 return (uint64_t)ret;
4175 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
4176 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
4177 for (size_t i = 0; i < ret.datalen; i++) {
4178 ret.data[i] = RouteHint_clone(&orig->data[i]);
4182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4183 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4186 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4187 CHECK(val->result_ok);
4188 LDKPositiveTimestamp res_var = (*val->contents.result);
4189 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4190 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4191 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4194 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4195 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4196 CHECK(!val->result_ok);
4197 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4201 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4204 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4205 CHECK(val->result_ok);
4206 return *val->contents.result;
4208 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4209 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4210 CHECK(!val->result_ok);
4211 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4215 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4218 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4219 CHECK(val->result_ok);
4220 LDKInvoice res_var = (*val->contents.result);
4221 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4222 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4223 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4226 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4227 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4228 CHECK(!val->result_ok);
4229 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4233 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4236 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4237 CHECK(val->result_ok);
4238 LDKDescription res_var = (*val->contents.result);
4239 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4240 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4241 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4244 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4245 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4246 CHECK(!val->result_ok);
4247 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4251 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4254 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4255 CHECK(val->result_ok);
4256 LDKExpiryTime res_var = (*val->contents.result);
4257 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4258 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4259 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4262 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4263 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4264 CHECK(!val->result_ok);
4265 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4269 return ((LDKCResult_RouteHintCreationErrorZ*)arg)->result_ok;
4271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4272 LDKCResult_RouteHintCreationErrorZ *val = (LDKCResult_RouteHintCreationErrorZ*)(arg & ~1);
4273 CHECK(val->result_ok);
4274 LDKRouteHint res_var = (*val->contents.result);
4275 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4276 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4277 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4280 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4281 LDKCResult_RouteHintCreationErrorZ *val = (LDKCResult_RouteHintCreationErrorZ*)(arg & ~1);
4282 CHECK(!val->result_ok);
4283 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4287 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4289 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4290 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4291 CHECK(val->result_ok);
4292 LDKStr res_str = (*val->contents.result);
4293 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4296 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4297 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4298 CHECK(!val->result_ok);
4299 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4302 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4303 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4306 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4307 CHECK(val->result_ok);
4308 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4309 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4310 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4311 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4315 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4316 CHECK(!val->result_ok);
4317 LDKDecodeError err_var = (*val->contents.err);
4318 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4319 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4320 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4324 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4327 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4328 CHECK(val->result_ok);
4329 LDKHTLCUpdate res_var = (*val->contents.result);
4330 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4331 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4332 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4336 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4337 CHECK(!val->result_ok);
4338 LDKDecodeError err_var = (*val->contents.err);
4339 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4340 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4341 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4345 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4348 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4349 CHECK(val->result_ok);
4350 return *val->contents.result;
4352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4353 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4354 CHECK(!val->result_ok);
4355 LDKMonitorUpdateError err_var = (*val->contents.err);
4356 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4357 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4358 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4362 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4364 a_conv.inner = (void*)(a & (~1));
4365 a_conv.is_owned = (a & 1) || (a == 0);
4366 a_conv = OutPoint_clone(&a_conv);
4369 b_ref.datalen = (*env)->GetArrayLength(env, b);
4370 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4371 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4373 return (uint64_t)ret;
4375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4376 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4377 LDKOutPoint a_var = tuple->a;
4378 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4379 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4380 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4384 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4385 LDKCVec_u8Z b_var = tuple->b;
4386 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4387 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4391 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4394 b_ref.datalen = (*env)->GetArrayLength(env, b);
4395 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4396 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4398 return (uint64_t)ret;
4400 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4401 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4405 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4406 LDKCVec_u8Z b_var = tuple->b;
4407 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4408 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4412 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4413 ret->datalen = (*env)->GetArrayLength(env, elems);
4414 if (ret->datalen == 0) {
4417 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
4418 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4419 for (size_t i = 0; i < ret->datalen; i++) {
4420 int64_t arr_elem = java_elems[i];
4421 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
4422 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
4423 ret->data[i] = arr_elem_conv;
4425 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4427 return (uint64_t)ret;
4429 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4430 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4431 for (size_t i = 0; i < ret.datalen; i++) {
4432 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4437 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
4438 LDKThirtyTwoBytes a_ref;
4439 CHECK((*env)->GetArrayLength(env, a) == 32);
4440 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4442 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
4443 b_constr.datalen = (*env)->GetArrayLength(env, b);
4444 if (b_constr.datalen > 0)
4445 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
4447 b_constr.data = NULL;
4448 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4449 for (size_t b = 0; b < b_constr.datalen; b++) {
4450 int64_t b_conv_27 = b_vals[b];
4451 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
4452 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
4453 b_constr.data[b] = b_conv_27_conv;
4455 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4457 return (uint64_t)ret;
4459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4460 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4461 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4462 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4465 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4466 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4467 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
4468 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4469 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4470 for (size_t b = 0; b < b_var.datalen; b++) {
4471 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
4472 b_arr_ptr[b] = b_conv_27_ref;
4474 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4478 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
4479 ret->datalen = (*env)->GetArrayLength(env, elems);
4480 if (ret->datalen == 0) {
4483 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
4484 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4485 for (size_t i = 0; i < ret->datalen; i++) {
4486 int64_t arr_elem = java_elems[i];
4487 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
4488 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
4489 ret->data[i] = arr_elem_conv;
4491 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4493 return (uint64_t)ret;
4495 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4496 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 };
4497 for (size_t i = 0; i < ret.datalen; i++) {
4498 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4502 static jclass LDKEvent_FundingGenerationReady_class = NULL;
4503 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
4504 static jclass LDKEvent_PaymentReceived_class = NULL;
4505 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
4506 static jclass LDKEvent_PaymentSent_class = NULL;
4507 static jmethodID LDKEvent_PaymentSent_meth = NULL;
4508 static jclass LDKEvent_PaymentFailed_class = NULL;
4509 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
4510 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
4511 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
4512 static jclass LDKEvent_SpendableOutputs_class = NULL;
4513 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
4514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
4515 LDKEvent_FundingGenerationReady_class =
4516 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
4517 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
4518 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
4519 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
4520 LDKEvent_PaymentReceived_class =
4521 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
4522 CHECK(LDKEvent_PaymentReceived_class != NULL);
4523 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[B[BJJ)V");
4524 CHECK(LDKEvent_PaymentReceived_meth != NULL);
4525 LDKEvent_PaymentSent_class =
4526 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
4527 CHECK(LDKEvent_PaymentSent_class != NULL);
4528 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
4529 CHECK(LDKEvent_PaymentSent_meth != NULL);
4530 LDKEvent_PaymentFailed_class =
4531 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
4532 CHECK(LDKEvent_PaymentFailed_class != NULL);
4533 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
4534 CHECK(LDKEvent_PaymentFailed_meth != NULL);
4535 LDKEvent_PendingHTLCsForwardable_class =
4536 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
4537 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
4538 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
4539 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
4540 LDKEvent_SpendableOutputs_class =
4541 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
4542 CHECK(LDKEvent_SpendableOutputs_class != NULL);
4543 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
4544 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
4546 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4547 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
4549 case LDKEvent_FundingGenerationReady: {
4550 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
4551 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
4552 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4553 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
4554 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
4555 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);
4557 case LDKEvent_PaymentReceived: {
4558 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4559 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
4560 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4561 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_received.payment_preimage.data);
4562 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
4563 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
4564 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_preimage_arr, payment_secret_arr, obj->payment_received.amt, obj->payment_received.user_payment_id);
4566 case LDKEvent_PaymentSent: {
4567 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4568 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
4569 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
4571 case LDKEvent_PaymentFailed: {
4572 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4573 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
4574 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
4576 case LDKEvent_PendingHTLCsForwardable: {
4577 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
4579 case LDKEvent_SpendableOutputs: {
4580 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4581 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
4582 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
4583 for (size_t b = 0; b < outputs_var.datalen; b++) {
4584 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
4585 outputs_arr_ptr[b] = outputs_conv_27_ref;
4587 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
4588 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
4593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4594 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
4595 ret->datalen = (*env)->GetArrayLength(env, elems);
4596 if (ret->datalen == 0) {
4599 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
4600 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4601 for (size_t i = 0; i < ret->datalen; i++) {
4602 int64_t arr_elem = java_elems[i];
4603 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
4604 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
4605 ret->data[i] = arr_elem_conv;
4607 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4609 return (uint64_t)ret;
4611 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4612 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4613 for (size_t i = 0; i < ret.datalen; i++) {
4614 ret.data[i] = Event_clone(&orig->data[i]);
4618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
4619 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4621 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
4622 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
4624 return (uint64_t)ret;
4626 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4627 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4631 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4632 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
4633 return (uint64_t)b_ref;
4635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4636 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
4637 ret->datalen = (*env)->GetArrayLength(env, elems);
4638 if (ret->datalen == 0) {
4641 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
4642 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4643 for (size_t i = 0; i < ret->datalen; i++) {
4644 int64_t arr_elem = java_elems[i];
4645 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
4646 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
4647 ret->data[i] = arr_elem_conv;
4649 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4651 return (uint64_t)ret;
4653 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4654 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4655 for (size_t i = 0; i < ret.datalen; i++) {
4656 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4661 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4662 LDKThirtyTwoBytes a_ref;
4663 CHECK((*env)->GetArrayLength(env, a) == 32);
4664 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4666 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4667 b_constr.datalen = (*env)->GetArrayLength(env, b);
4668 if (b_constr.datalen > 0)
4669 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4671 b_constr.data = NULL;
4672 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4673 for (size_t a = 0; a < b_constr.datalen; a++) {
4674 int64_t b_conv_26 = b_vals[a];
4675 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
4676 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
4677 b_constr.data[a] = b_conv_26_conv;
4679 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4681 return (uint64_t)ret;
4683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4684 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4685 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4686 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4689 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4690 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4691 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
4692 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4693 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4694 for (size_t a = 0; a < b_var.datalen; a++) {
4695 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
4696 b_arr_ptr[a] = b_conv_26_ref;
4698 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4702 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
4703 ret->datalen = (*env)->GetArrayLength(env, elems);
4704 if (ret->datalen == 0) {
4707 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
4708 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4709 for (size_t i = 0; i < ret->datalen; i++) {
4710 int64_t arr_elem = java_elems[i];
4711 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
4712 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
4713 ret->data[i] = arr_elem_conv;
4715 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4717 return (uint64_t)ret;
4719 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
4720 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 };
4721 for (size_t i = 0; i < ret.datalen; i++) {
4722 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
4726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4727 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
4729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4730 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4731 CHECK(val->result_ok);
4732 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4736 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4737 CHECK(!val->result_ok);
4738 LDKDecodeError err_var = (*val->contents.err);
4739 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4740 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4741 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4745 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4748 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4749 CHECK(val->result_ok);
4750 return *val->contents.result;
4752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4753 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4754 CHECK(!val->result_ok);
4755 LDKLightningError err_var = (*val->contents.err);
4756 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4757 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4758 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
4762 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4763 LDKChannelAnnouncement a_conv;
4764 a_conv.inner = (void*)(a & (~1));
4765 a_conv.is_owned = (a & 1) || (a == 0);
4766 a_conv = ChannelAnnouncement_clone(&a_conv);
4768 LDKChannelUpdate b_conv;
4769 b_conv.inner = (void*)(b & (~1));
4770 b_conv.is_owned = (b & 1) || (b == 0);
4771 b_conv = ChannelUpdate_clone(&b_conv);
4773 LDKChannelUpdate c_conv;
4774 c_conv.inner = (void*)(c & (~1));
4775 c_conv.is_owned = (c & 1) || (c == 0);
4776 c_conv = ChannelUpdate_clone(&c_conv);
4778 return (uint64_t)ret;
4780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4781 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4782 LDKChannelAnnouncement a_var = tuple->a;
4783 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4784 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4785 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4789 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4790 LDKChannelUpdate b_var = tuple->b;
4791 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4792 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4793 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4797 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4798 LDKChannelUpdate c_var = tuple->c;
4799 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4800 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4801 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4805 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4806 ret->datalen = (*env)->GetArrayLength(env, elems);
4807 if (ret->datalen == 0) {
4810 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4811 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4812 for (size_t i = 0; i < ret->datalen; i++) {
4813 int64_t arr_elem = java_elems[i];
4814 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
4815 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4816 ret->data[i] = arr_elem_conv;
4818 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4820 return (uint64_t)ret;
4822 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4823 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4824 for (size_t i = 0; i < ret.datalen; i++) {
4825 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4830 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4831 ret->datalen = (*env)->GetArrayLength(env, elems);
4832 if (ret->datalen == 0) {
4835 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4836 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4837 for (size_t i = 0; i < ret->datalen; i++) {
4838 int64_t arr_elem = java_elems[i];
4839 LDKNodeAnnouncement arr_elem_conv;
4840 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4841 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4842 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4843 ret->data[i] = arr_elem_conv;
4845 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4847 return (uint64_t)ret;
4849 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4850 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4851 for (size_t i = 0; i < ret.datalen; i++) {
4852 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4857 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4860 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4861 CHECK(val->result_ok);
4862 return *val->contents.result;
4864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4865 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4866 CHECK(!val->result_ok);
4867 LDKLightningError err_var = (*val->contents.err);
4868 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4869 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4870 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4874 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4877 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4878 CHECK(val->result_ok);
4879 LDKCVec_u8Z res_var = (*val->contents.result);
4880 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
4881 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
4884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4885 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4886 CHECK(!val->result_ok);
4887 LDKPeerHandleError err_var = (*val->contents.err);
4888 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4889 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4890 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4894 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4897 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4898 CHECK(val->result_ok);
4899 return *val->contents.result;
4901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4902 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4903 CHECK(!val->result_ok);
4904 LDKPeerHandleError err_var = (*val->contents.err);
4905 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4906 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4907 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4911 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4914 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4915 CHECK(val->result_ok);
4916 return *val->contents.result;
4918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4919 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4920 CHECK(!val->result_ok);
4921 LDKPeerHandleError err_var = (*val->contents.err);
4922 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4923 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4924 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4928 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4931 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4932 CHECK(val->result_ok);
4933 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4934 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4935 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4936 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4940 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4941 CHECK(!val->result_ok);
4942 LDKDecodeError err_var = (*val->contents.err);
4943 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4944 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4945 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4949 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4952 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4953 CHECK(val->result_ok);
4954 LDKChannelInfo res_var = (*val->contents.result);
4955 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4956 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4957 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4961 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4962 CHECK(!val->result_ok);
4963 LDKDecodeError err_var = (*val->contents.err);
4964 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4965 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4966 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4970 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4973 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4974 CHECK(val->result_ok);
4975 LDKRoutingFees res_var = (*val->contents.result);
4976 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4977 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4978 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4982 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4983 CHECK(!val->result_ok);
4984 LDKDecodeError err_var = (*val->contents.err);
4985 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4986 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4987 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4990 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4991 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4994 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4995 CHECK(val->result_ok);
4996 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4997 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4998 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4999 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5003 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5004 CHECK(!val->result_ok);
5005 LDKDecodeError err_var = (*val->contents.err);
5006 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5007 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5008 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5012 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5013 ret->datalen = (*env)->GetArrayLength(env, elems);
5014 if (ret->datalen == 0) {
5017 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5018 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5019 for (size_t i = 0; i < ret->datalen; i++) {
5020 ret->data[i] = java_elems[i];
5022 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5024 return (uint64_t)ret;
5026 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5027 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5028 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5032 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
5034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5035 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5036 CHECK(val->result_ok);
5037 LDKNodeInfo res_var = (*val->contents.result);
5038 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5039 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5040 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5044 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5045 CHECK(!val->result_ok);
5046 LDKDecodeError err_var = (*val->contents.err);
5047 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5048 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5049 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5053 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
5055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5056 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5057 CHECK(val->result_ok);
5058 LDKNetworkGraph res_var = (*val->contents.result);
5059 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5060 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5061 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5065 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5066 CHECK(!val->result_ok);
5067 LDKDecodeError err_var = (*val->contents.err);
5068 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5069 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5070 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5073 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5074 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
5076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5077 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5078 CHECK(val->result_ok);
5079 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5082 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5083 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5084 CHECK(!val->result_ok);
5085 return *val->contents.err;
5087 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5088 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
5090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5091 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5092 CHECK(val->result_ok);
5093 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5094 *res_conv = (*val->contents.result);
5095 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
5096 return (uint64_t)res_conv;
5098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5099 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5100 CHECK(!val->result_ok);
5101 LDKDecodeError err_var = (*val->contents.err);
5102 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5103 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5104 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5108 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
5110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5111 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5112 CHECK(val->result_ok);
5113 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5117 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5118 CHECK(!val->result_ok);
5119 LDKDecodeError err_var = (*val->contents.err);
5120 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5121 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5122 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5126 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
5127 ret->datalen = (*env)->GetArrayLength(env, elems);
5128 if (ret->datalen == 0) {
5131 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
5132 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5133 for (size_t i = 0; i < ret->datalen; i++) {
5134 int64_t arr_elem = java_elems[i];
5135 LDKUpdateAddHTLC arr_elem_conv;
5136 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5137 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5138 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
5139 ret->data[i] = arr_elem_conv;
5141 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5143 return (uint64_t)ret;
5145 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
5146 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
5147 for (size_t i = 0; i < ret.datalen; i++) {
5148 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
5152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5153 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
5154 ret->datalen = (*env)->GetArrayLength(env, elems);
5155 if (ret->datalen == 0) {
5158 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
5159 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5160 for (size_t i = 0; i < ret->datalen; i++) {
5161 int64_t arr_elem = java_elems[i];
5162 LDKUpdateFulfillHTLC arr_elem_conv;
5163 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5164 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5165 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
5166 ret->data[i] = arr_elem_conv;
5168 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5170 return (uint64_t)ret;
5172 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
5173 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
5174 for (size_t i = 0; i < ret.datalen; i++) {
5175 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
5179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5180 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
5181 ret->datalen = (*env)->GetArrayLength(env, elems);
5182 if (ret->datalen == 0) {
5185 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
5186 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5187 for (size_t i = 0; i < ret->datalen; i++) {
5188 int64_t arr_elem = java_elems[i];
5189 LDKUpdateFailHTLC arr_elem_conv;
5190 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5191 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5192 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
5193 ret->data[i] = arr_elem_conv;
5195 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5197 return (uint64_t)ret;
5199 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
5200 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
5201 for (size_t i = 0; i < ret.datalen; i++) {
5202 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
5206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5207 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
5208 ret->datalen = (*env)->GetArrayLength(env, elems);
5209 if (ret->datalen == 0) {
5212 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
5213 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5214 for (size_t i = 0; i < ret->datalen; i++) {
5215 int64_t arr_elem = java_elems[i];
5216 LDKUpdateFailMalformedHTLC arr_elem_conv;
5217 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5218 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5219 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
5220 ret->data[i] = arr_elem_conv;
5222 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5224 return (uint64_t)ret;
5226 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
5227 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
5228 for (size_t i = 0; i < ret.datalen; i++) {
5229 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
5233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5234 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
5236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5237 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5238 CHECK(val->result_ok);
5239 LDKAcceptChannel res_var = (*val->contents.result);
5240 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5241 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5242 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5246 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5247 CHECK(!val->result_ok);
5248 LDKDecodeError err_var = (*val->contents.err);
5249 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5250 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5251 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5254 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5255 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
5257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5258 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5259 CHECK(val->result_ok);
5260 LDKAnnouncementSignatures res_var = (*val->contents.result);
5261 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5262 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5263 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5267 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5268 CHECK(!val->result_ok);
5269 LDKDecodeError err_var = (*val->contents.err);
5270 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5271 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5272 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5276 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
5278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5279 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5280 CHECK(val->result_ok);
5281 LDKChannelReestablish res_var = (*val->contents.result);
5282 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5283 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5284 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5288 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5289 CHECK(!val->result_ok);
5290 LDKDecodeError err_var = (*val->contents.err);
5291 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5292 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5293 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5297 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
5299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5300 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5301 CHECK(val->result_ok);
5302 LDKClosingSigned res_var = (*val->contents.result);
5303 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5304 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5305 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5309 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5310 CHECK(!val->result_ok);
5311 LDKDecodeError err_var = (*val->contents.err);
5312 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5313 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5314 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5318 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
5320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5321 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5322 CHECK(val->result_ok);
5323 LDKCommitmentSigned res_var = (*val->contents.result);
5324 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5325 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5326 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5330 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5331 CHECK(!val->result_ok);
5332 LDKDecodeError err_var = (*val->contents.err);
5333 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5334 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5335 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5339 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
5341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5342 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5343 CHECK(val->result_ok);
5344 LDKFundingCreated res_var = (*val->contents.result);
5345 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5346 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5347 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5351 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5352 CHECK(!val->result_ok);
5353 LDKDecodeError err_var = (*val->contents.err);
5354 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5355 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5356 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5360 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
5362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5363 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5364 CHECK(val->result_ok);
5365 LDKFundingSigned res_var = (*val->contents.result);
5366 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5367 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5368 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5372 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5373 CHECK(!val->result_ok);
5374 LDKDecodeError err_var = (*val->contents.err);
5375 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5376 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5377 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5381 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
5383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5384 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5385 CHECK(val->result_ok);
5386 LDKFundingLocked res_var = (*val->contents.result);
5387 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5388 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5389 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5393 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5394 CHECK(!val->result_ok);
5395 LDKDecodeError err_var = (*val->contents.err);
5396 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5397 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5398 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5401 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5402 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
5404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5405 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5406 CHECK(val->result_ok);
5407 LDKInit res_var = (*val->contents.result);
5408 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5409 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5410 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5414 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5415 CHECK(!val->result_ok);
5416 LDKDecodeError err_var = (*val->contents.err);
5417 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5418 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5419 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5423 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
5425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5426 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5427 CHECK(val->result_ok);
5428 LDKOpenChannel res_var = (*val->contents.result);
5429 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5430 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5431 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5435 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5436 CHECK(!val->result_ok);
5437 LDKDecodeError err_var = (*val->contents.err);
5438 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5439 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5440 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5444 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5447 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5448 CHECK(val->result_ok);
5449 LDKRevokeAndACK res_var = (*val->contents.result);
5450 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5451 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5452 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5456 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5457 CHECK(!val->result_ok);
5458 LDKDecodeError err_var = (*val->contents.err);
5459 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5460 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5461 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5465 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5468 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5469 CHECK(val->result_ok);
5470 LDKShutdown res_var = (*val->contents.result);
5471 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5472 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5473 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5477 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5478 CHECK(!val->result_ok);
5479 LDKDecodeError err_var = (*val->contents.err);
5480 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5481 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5482 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5486 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5489 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5490 CHECK(val->result_ok);
5491 LDKUpdateFailHTLC res_var = (*val->contents.result);
5492 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5493 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5494 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5498 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5499 CHECK(!val->result_ok);
5500 LDKDecodeError err_var = (*val->contents.err);
5501 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5502 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5503 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5507 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5510 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5511 CHECK(val->result_ok);
5512 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5513 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5514 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5515 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5519 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5520 CHECK(!val->result_ok);
5521 LDKDecodeError err_var = (*val->contents.err);
5522 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5523 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5524 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5528 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5531 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5532 CHECK(val->result_ok);
5533 LDKUpdateFee res_var = (*val->contents.result);
5534 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5535 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5536 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5540 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5541 CHECK(!val->result_ok);
5542 LDKDecodeError err_var = (*val->contents.err);
5543 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5544 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5545 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5549 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5552 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5553 CHECK(val->result_ok);
5554 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5555 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5556 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5557 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5561 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5562 CHECK(!val->result_ok);
5563 LDKDecodeError err_var = (*val->contents.err);
5564 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5565 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5566 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5570 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5573 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5574 CHECK(val->result_ok);
5575 LDKUpdateAddHTLC res_var = (*val->contents.result);
5576 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5577 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5578 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5582 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5583 CHECK(!val->result_ok);
5584 LDKDecodeError err_var = (*val->contents.err);
5585 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5586 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5587 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5590 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5591 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5594 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5595 CHECK(val->result_ok);
5596 LDKPing res_var = (*val->contents.result);
5597 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5598 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5599 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5603 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5604 CHECK(!val->result_ok);
5605 LDKDecodeError err_var = (*val->contents.err);
5606 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5607 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5608 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5612 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5615 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5616 CHECK(val->result_ok);
5617 LDKPong res_var = (*val->contents.result);
5618 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5619 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5620 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5624 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5625 CHECK(!val->result_ok);
5626 LDKDecodeError err_var = (*val->contents.err);
5627 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5628 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5629 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5633 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5636 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5637 CHECK(val->result_ok);
5638 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5639 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5640 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5641 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5645 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5646 CHECK(!val->result_ok);
5647 LDKDecodeError err_var = (*val->contents.err);
5648 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5649 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5650 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5654 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5657 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5658 CHECK(val->result_ok);
5659 LDKChannelAnnouncement res_var = (*val->contents.result);
5660 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5661 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5662 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5666 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5667 CHECK(!val->result_ok);
5668 LDKDecodeError err_var = (*val->contents.err);
5669 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5670 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5671 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5675 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5678 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5679 CHECK(val->result_ok);
5680 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5681 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5682 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5683 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5687 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5688 CHECK(!val->result_ok);
5689 LDKDecodeError err_var = (*val->contents.err);
5690 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5691 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5692 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5696 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5699 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5700 CHECK(val->result_ok);
5701 LDKChannelUpdate res_var = (*val->contents.result);
5702 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5703 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5704 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5708 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5709 CHECK(!val->result_ok);
5710 LDKDecodeError err_var = (*val->contents.err);
5711 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5712 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5713 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5717 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5720 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5721 CHECK(val->result_ok);
5722 LDKErrorMessage res_var = (*val->contents.result);
5723 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5724 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5725 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5729 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5730 CHECK(!val->result_ok);
5731 LDKDecodeError err_var = (*val->contents.err);
5732 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5733 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5734 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5737 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5738 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5741 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5742 CHECK(val->result_ok);
5743 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5744 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5745 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5746 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5750 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5751 CHECK(!val->result_ok);
5752 LDKDecodeError err_var = (*val->contents.err);
5753 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5754 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5755 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5759 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5762 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5763 CHECK(val->result_ok);
5764 LDKNodeAnnouncement res_var = (*val->contents.result);
5765 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5766 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5767 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5771 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5772 CHECK(!val->result_ok);
5773 LDKDecodeError err_var = (*val->contents.err);
5774 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5775 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5776 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5780 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5783 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5784 CHECK(val->result_ok);
5785 LDKQueryShortChannelIds res_var = (*val->contents.result);
5786 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5787 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5788 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5792 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5793 CHECK(!val->result_ok);
5794 LDKDecodeError err_var = (*val->contents.err);
5795 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5796 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5797 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5801 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5804 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5805 CHECK(val->result_ok);
5806 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5807 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5808 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5809 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5813 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5814 CHECK(!val->result_ok);
5815 LDKDecodeError err_var = (*val->contents.err);
5816 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5817 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5818 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5822 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5825 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5826 CHECK(val->result_ok);
5827 LDKQueryChannelRange res_var = (*val->contents.result);
5828 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5829 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5830 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5834 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5835 CHECK(!val->result_ok);
5836 LDKDecodeError err_var = (*val->contents.err);
5837 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5838 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5839 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5842 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5843 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5846 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5847 CHECK(val->result_ok);
5848 LDKReplyChannelRange res_var = (*val->contents.result);
5849 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5850 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5851 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5855 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5856 CHECK(!val->result_ok);
5857 LDKDecodeError err_var = (*val->contents.err);
5858 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5859 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5860 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5863 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5864 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5867 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5868 CHECK(val->result_ok);
5869 LDKGossipTimestampFilter res_var = (*val->contents.result);
5870 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5871 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5872 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5876 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5877 CHECK(!val->result_ok);
5878 LDKDecodeError err_var = (*val->contents.err);
5879 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5880 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5881 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5884 static jclass LDKSignOrCreationError_SignError_class = NULL;
5885 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
5886 static jclass LDKSignOrCreationError_CreationError_class = NULL;
5887 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
5888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
5889 LDKSignOrCreationError_SignError_class =
5890 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
5891 CHECK(LDKSignOrCreationError_SignError_class != NULL);
5892 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
5893 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
5894 LDKSignOrCreationError_CreationError_class =
5895 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
5896 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
5897 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
5898 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
5900 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5901 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5903 case LDKSignOrCreationError_SignError: {
5904 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
5906 case LDKSignOrCreationError_CreationError: {
5907 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
5908 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
5913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5914 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5917 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5918 CHECK(val->result_ok);
5919 LDKInvoice res_var = (*val->contents.result);
5920 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5921 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5922 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5926 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5927 CHECK(!val->result_ok);
5928 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5931 typedef struct LDKMessageSendEventsProvider_JCalls {
5932 atomic_size_t refcnt;
5935 jmethodID get_and_clear_pending_msg_events_meth;
5936 } LDKMessageSendEventsProvider_JCalls;
5937 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5938 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5939 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5941 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5942 if (get_jenv_res == JNI_EDETACHED) {
5943 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5945 DO_ASSERT(get_jenv_res == JNI_OK);
5947 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5948 if (get_jenv_res == JNI_EDETACHED) {
5949 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5954 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5955 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5957 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5958 if (get_jenv_res == JNI_EDETACHED) {
5959 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5961 DO_ASSERT(get_jenv_res == JNI_OK);
5963 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5965 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
5966 LDKCVec_MessageSendEventZ ret_constr;
5967 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5968 if (ret_constr.datalen > 0)
5969 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5971 ret_constr.data = NULL;
5972 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5973 for (size_t s = 0; s < ret_constr.datalen; s++) {
5974 int64_t ret_conv_18 = ret_vals[s];
5975 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
5976 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5977 ret_constr.data[s] = ret_conv_18_conv;
5979 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5980 if (get_jenv_res == JNI_EDETACHED) {
5981 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5985 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
5986 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5987 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5988 return (void*) this_arg;
5990 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
5991 jclass c = (*env)->GetObjectClass(env, o);
5993 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5994 atomic_init(&calls->refcnt, 1);
5995 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5996 calls->o = (*env)->NewWeakGlobalRef(env, o);
5997 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
5998 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
6000 LDKMessageSendEventsProvider ret = {
6001 .this_arg = (void*) calls,
6002 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6003 .free = LDKMessageSendEventsProvider_JCalls_free,
6007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6008 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6009 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
6010 return (uint64_t)res_ptr;
6012 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6013 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
6014 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6015 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6016 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6017 for (size_t s = 0; s < ret_var.datalen; s++) {
6018 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6019 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
6020 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6021 ret_arr_ptr[s] = ret_conv_18_ref;
6023 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6028 typedef struct LDKEventHandler_JCalls {
6029 atomic_size_t refcnt;
6032 jmethodID handle_event_meth;
6033 } LDKEventHandler_JCalls;
6034 static void LDKEventHandler_JCalls_free(void* this_arg) {
6035 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6036 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6038 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6039 if (get_jenv_res == JNI_EDETACHED) {
6040 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6042 DO_ASSERT(get_jenv_res == JNI_OK);
6044 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6045 if (get_jenv_res == JNI_EDETACHED) {
6046 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6051 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
6052 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6054 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6055 if (get_jenv_res == JNI_EDETACHED) {
6056 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6058 DO_ASSERT(get_jenv_res == JNI_OK);
6060 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6061 *event_copy = event;
6062 uint64_t event_ref = (uint64_t)event_copy;
6063 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6065 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
6066 if (get_jenv_res == JNI_EDETACHED) {
6067 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6070 static void* LDKEventHandler_JCalls_clone(const void* this_arg) {
6071 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6072 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6073 return (void*) this_arg;
6075 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
6076 jclass c = (*env)->GetObjectClass(env, o);
6078 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6079 atomic_init(&calls->refcnt, 1);
6080 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6081 calls->o = (*env)->NewWeakGlobalRef(env, o);
6082 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
6083 CHECK(calls->handle_event_meth != NULL);
6085 LDKEventHandler ret = {
6086 .this_arg = (void*) calls,
6087 .handle_event = handle_event_LDKEventHandler_jcall,
6088 .free = LDKEventHandler_JCalls_free,
6092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
6093 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6094 *res_ptr = LDKEventHandler_init(env, clz, o);
6095 return (uint64_t)res_ptr;
6097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
6098 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
6099 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
6100 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6103 typedef struct LDKEventsProvider_JCalls {
6104 atomic_size_t refcnt;
6107 jmethodID process_pending_events_meth;
6108 } LDKEventsProvider_JCalls;
6109 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6110 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6111 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6113 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6114 if (get_jenv_res == JNI_EDETACHED) {
6115 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6117 DO_ASSERT(get_jenv_res == JNI_OK);
6119 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6120 if (get_jenv_res == JNI_EDETACHED) {
6121 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6126 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6127 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6129 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6130 if (get_jenv_res == JNI_EDETACHED) {
6131 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6133 DO_ASSERT(get_jenv_res == JNI_OK);
6135 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6137 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6139 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
6140 if (get_jenv_res == JNI_EDETACHED) {
6141 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6144 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
6145 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6146 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6147 return (void*) this_arg;
6149 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6150 jclass c = (*env)->GetObjectClass(env, o);
6152 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6153 atomic_init(&calls->refcnt, 1);
6154 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6155 calls->o = (*env)->NewWeakGlobalRef(env, o);
6156 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
6157 CHECK(calls->process_pending_events_meth != NULL);
6159 LDKEventsProvider ret = {
6160 .this_arg = (void*) calls,
6161 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6162 .free = LDKEventsProvider_JCalls_free,
6166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6167 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6168 *res_ptr = LDKEventsProvider_init(env, clz, o);
6169 return (uint64_t)res_ptr;
6171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
6172 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
6173 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
6174 if (handler_conv.free == LDKEventHandler_JCalls_free) {
6175 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6176 LDKEventHandler_JCalls_clone(handler_conv.this_arg);
6178 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6181 typedef struct LDKAccess_JCalls {
6182 atomic_size_t refcnt;
6185 jmethodID get_utxo_meth;
6187 static void LDKAccess_JCalls_free(void* this_arg) {
6188 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6189 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6191 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6192 if (get_jenv_res == JNI_EDETACHED) {
6193 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6195 DO_ASSERT(get_jenv_res == JNI_OK);
6197 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6198 if (get_jenv_res == JNI_EDETACHED) {
6199 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6204 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6205 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6207 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6208 if (get_jenv_res == JNI_EDETACHED) {
6209 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6211 DO_ASSERT(get_jenv_res == JNI_OK);
6213 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6214 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6215 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6217 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6218 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
6219 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6220 if (get_jenv_res == JNI_EDETACHED) {
6221 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6225 static void* LDKAccess_JCalls_clone(const void* this_arg) {
6226 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6227 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6228 return (void*) this_arg;
6230 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6231 jclass c = (*env)->GetObjectClass(env, o);
6233 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6234 atomic_init(&calls->refcnt, 1);
6235 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6236 calls->o = (*env)->NewWeakGlobalRef(env, o);
6237 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6238 CHECK(calls->get_utxo_meth != NULL);
6241 .this_arg = (void*) calls,
6242 .get_utxo = get_utxo_LDKAccess_jcall,
6243 .free = LDKAccess_JCalls_free,
6247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6248 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6249 *res_ptr = LDKAccess_init(env, clz, o);
6250 return (uint64_t)res_ptr;
6252 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) {
6253 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6254 unsigned char genesis_hash_arr[32];
6255 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6256 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6257 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6258 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6259 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6260 return (uint64_t)ret_conv;
6263 typedef struct LDKListen_JCalls {
6264 atomic_size_t refcnt;
6267 jmethodID block_connected_meth;
6268 jmethodID block_disconnected_meth;
6270 static void LDKListen_JCalls_free(void* this_arg) {
6271 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6272 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6274 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6275 if (get_jenv_res == JNI_EDETACHED) {
6276 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6278 DO_ASSERT(get_jenv_res == JNI_OK);
6280 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6281 if (get_jenv_res == JNI_EDETACHED) {
6282 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6287 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6288 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6290 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6291 if (get_jenv_res == JNI_EDETACHED) {
6292 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6294 DO_ASSERT(get_jenv_res == JNI_OK);
6296 LDKu8slice block_var = block;
6297 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
6298 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
6299 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6301 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
6302 if (get_jenv_res == JNI_EDETACHED) {
6303 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6306 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6307 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6309 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6310 if (get_jenv_res == JNI_EDETACHED) {
6311 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6313 DO_ASSERT(get_jenv_res == JNI_OK);
6315 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6316 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6317 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6319 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
6320 if (get_jenv_res == JNI_EDETACHED) {
6321 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6324 static void* LDKListen_JCalls_clone(const void* this_arg) {
6325 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6326 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6327 return (void*) this_arg;
6329 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
6330 jclass c = (*env)->GetObjectClass(env, o);
6332 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6333 atomic_init(&calls->refcnt, 1);
6334 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6335 calls->o = (*env)->NewWeakGlobalRef(env, o);
6336 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
6337 CHECK(calls->block_connected_meth != NULL);
6338 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
6339 CHECK(calls->block_disconnected_meth != NULL);
6342 .this_arg = (void*) calls,
6343 .block_connected = block_connected_LDKListen_jcall,
6344 .block_disconnected = block_disconnected_LDKListen_jcall,
6345 .free = LDKListen_JCalls_free,
6349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
6350 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6351 *res_ptr = LDKListen_init(env, clz, o);
6352 return (uint64_t)res_ptr;
6354 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) {
6355 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6356 LDKu8slice block_ref;
6357 block_ref.datalen = (*env)->GetArrayLength(env, block);
6358 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
6359 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6360 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
6363 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) {
6364 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6365 unsigned char header_arr[80];
6366 CHECK((*env)->GetArrayLength(env, header) == 80);
6367 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6368 unsigned char (*header_ref)[80] = &header_arr;
6369 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6372 typedef struct LDKConfirm_JCalls {
6373 atomic_size_t refcnt;
6376 jmethodID transactions_confirmed_meth;
6377 jmethodID transaction_unconfirmed_meth;
6378 jmethodID best_block_updated_meth;
6379 jmethodID get_relevant_txids_meth;
6380 } LDKConfirm_JCalls;
6381 static void LDKConfirm_JCalls_free(void* this_arg) {
6382 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6383 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6385 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6386 if (get_jenv_res == JNI_EDETACHED) {
6387 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6389 DO_ASSERT(get_jenv_res == JNI_OK);
6391 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6392 if (get_jenv_res == JNI_EDETACHED) {
6393 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6398 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6399 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6401 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6402 if (get_jenv_res == JNI_EDETACHED) {
6403 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6405 DO_ASSERT(get_jenv_res == JNI_OK);
6407 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6408 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6409 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6410 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
6411 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
6412 for (size_t y = 0; y < txdata_var.datalen; y++) {
6413 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6414 *txdata_conv_24_ref = txdata_var.data[y];
6415 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
6417 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
6418 FREE(txdata_var.data);
6419 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6421 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
6422 if (get_jenv_res == JNI_EDETACHED) {
6423 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6426 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6427 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6429 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6430 if (get_jenv_res == JNI_EDETACHED) {
6431 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6433 DO_ASSERT(get_jenv_res == JNI_OK);
6435 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6436 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6437 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6439 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
6440 if (get_jenv_res == JNI_EDETACHED) {
6441 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6444 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6445 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6447 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6448 if (get_jenv_res == JNI_EDETACHED) {
6449 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6451 DO_ASSERT(get_jenv_res == JNI_OK);
6453 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6454 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6455 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6457 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
6458 if (get_jenv_res == JNI_EDETACHED) {
6459 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6462 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6463 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6465 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6466 if (get_jenv_res == JNI_EDETACHED) {
6467 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6469 DO_ASSERT(get_jenv_res == JNI_OK);
6471 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6473 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
6474 LDKCVec_TxidZ ret_constr;
6475 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6476 if (ret_constr.datalen > 0)
6477 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6479 ret_constr.data = NULL;
6480 for (size_t i = 0; i < ret_constr.datalen; i++) {
6481 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
6482 LDKThirtyTwoBytes ret_conv_8_ref;
6483 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
6484 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
6485 ret_constr.data[i] = ret_conv_8_ref;
6487 if (get_jenv_res == JNI_EDETACHED) {
6488 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6492 static void* LDKConfirm_JCalls_clone(const void* this_arg) {
6493 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6494 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6495 return (void*) this_arg;
6497 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
6498 jclass c = (*env)->GetObjectClass(env, o);
6500 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6501 atomic_init(&calls->refcnt, 1);
6502 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6503 calls->o = (*env)->NewWeakGlobalRef(env, o);
6504 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
6505 CHECK(calls->transactions_confirmed_meth != NULL);
6506 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
6507 CHECK(calls->transaction_unconfirmed_meth != NULL);
6508 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
6509 CHECK(calls->best_block_updated_meth != NULL);
6510 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
6511 CHECK(calls->get_relevant_txids_meth != NULL);
6514 .this_arg = (void*) calls,
6515 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6516 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6517 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6518 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6519 .free = LDKConfirm_JCalls_free,
6523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
6524 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6525 *res_ptr = LDKConfirm_init(env, clz, o);
6526 return (uint64_t)res_ptr;
6528 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) {
6529 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6530 unsigned char header_arr[80];
6531 CHECK((*env)->GetArrayLength(env, header) == 80);
6532 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6533 unsigned char (*header_ref)[80] = &header_arr;
6534 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6535 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
6536 if (txdata_constr.datalen > 0)
6537 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6539 txdata_constr.data = NULL;
6540 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
6541 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6542 int64_t txdata_conv_24 = txdata_vals[y];
6543 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
6544 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
6545 txdata_constr.data[y] = txdata_conv_24_conv;
6547 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
6548 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
6552 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6553 unsigned char txid_arr[32];
6554 CHECK((*env)->GetArrayLength(env, txid) == 32);
6555 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6556 unsigned char (*txid_ref)[32] = &txid_arr;
6557 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6560 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) {
6561 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6562 unsigned char header_arr[80];
6563 CHECK((*env)->GetArrayLength(env, header) == 80);
6564 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6565 unsigned char (*header_ref)[80] = &header_arr;
6566 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6569 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
6570 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6571 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6572 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6574 for (size_t i = 0; i < ret_var.datalen; i++) {
6575 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
6576 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
6577 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6583 typedef struct LDKFilter_JCalls {
6584 atomic_size_t refcnt;
6587 jmethodID register_tx_meth;
6588 jmethodID register_output_meth;
6590 static void LDKFilter_JCalls_free(void* this_arg) {
6591 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6592 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6594 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6595 if (get_jenv_res == JNI_EDETACHED) {
6596 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6598 DO_ASSERT(get_jenv_res == JNI_OK);
6600 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6601 if (get_jenv_res == JNI_EDETACHED) {
6602 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6607 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6608 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6610 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6611 if (get_jenv_res == JNI_EDETACHED) {
6612 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6614 DO_ASSERT(get_jenv_res == JNI_OK);
6616 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6617 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6618 LDKu8slice script_pubkey_var = script_pubkey;
6619 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6620 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6621 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6623 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6624 if (get_jenv_res == JNI_EDETACHED) {
6625 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6628 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6629 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6631 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6632 if (get_jenv_res == JNI_EDETACHED) {
6633 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6635 DO_ASSERT(get_jenv_res == JNI_OK);
6637 LDKWatchedOutput output_var = output;
6638 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6639 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6640 uint64_t output_ref = (uint64_t)output_var.inner;
6641 if (output_var.is_owned) {
6644 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6646 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
6647 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
6648 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
6649 if (get_jenv_res == JNI_EDETACHED) {
6650 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6654 static void* LDKFilter_JCalls_clone(const void* this_arg) {
6655 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6656 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6657 return (void*) this_arg;
6659 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
6660 jclass c = (*env)->GetObjectClass(env, o);
6662 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
6663 atomic_init(&calls->refcnt, 1);
6664 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6665 calls->o = (*env)->NewWeakGlobalRef(env, o);
6666 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
6667 CHECK(calls->register_tx_meth != NULL);
6668 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
6669 CHECK(calls->register_output_meth != NULL);
6672 .this_arg = (void*) calls,
6673 .register_tx = register_tx_LDKFilter_jcall,
6674 .register_output = register_output_LDKFilter_jcall,
6675 .free = LDKFilter_JCalls_free,
6679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
6680 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
6681 *res_ptr = LDKFilter_init(env, clz, o);
6682 return (uint64_t)res_ptr;
6684 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) {
6685 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6686 unsigned char txid_arr[32];
6687 CHECK((*env)->GetArrayLength(env, txid) == 32);
6688 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6689 unsigned char (*txid_ref)[32] = &txid_arr;
6690 LDKu8slice script_pubkey_ref;
6691 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
6692 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
6693 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
6694 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
6697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
6698 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6699 LDKWatchedOutput output_conv;
6700 output_conv.inner = (void*)(output & (~1));
6701 output_conv.is_owned = (output & 1) || (output == 0);
6702 output_conv = WatchedOutput_clone(&output_conv);
6703 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
6704 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
6705 uint64_t ret_ref = (uint64_t)ret_copy;
6709 typedef struct LDKPersist_JCalls {
6710 atomic_size_t refcnt;
6713 jmethodID persist_new_channel_meth;
6714 jmethodID update_persisted_channel_meth;
6715 } LDKPersist_JCalls;
6716 static void LDKPersist_JCalls_free(void* this_arg) {
6717 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6718 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6720 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6721 if (get_jenv_res == JNI_EDETACHED) {
6722 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6724 DO_ASSERT(get_jenv_res == JNI_OK);
6726 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6727 if (get_jenv_res == JNI_EDETACHED) {
6728 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6733 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
6734 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6736 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6737 if (get_jenv_res == JNI_EDETACHED) {
6738 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6740 DO_ASSERT(get_jenv_res == JNI_OK);
6742 LDKOutPoint id_var = id;
6743 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6744 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6745 uint64_t id_ref = (uint64_t)id_var.inner;
6746 if (id_var.is_owned) {
6749 LDKChannelMonitor data_var = *data;
6750 data_var = ChannelMonitor_clone(data);
6751 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6752 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6753 uint64_t data_ref = (uint64_t)data_var.inner;
6754 if (data_var.is_owned) {
6757 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6759 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
6760 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6761 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6762 if (get_jenv_res == JNI_EDETACHED) {
6763 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6767 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
6768 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6770 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6771 if (get_jenv_res == JNI_EDETACHED) {
6772 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6774 DO_ASSERT(get_jenv_res == JNI_OK);
6776 LDKOutPoint id_var = id;
6777 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6778 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6779 uint64_t id_ref = (uint64_t)id_var.inner;
6780 if (id_var.is_owned) {
6783 LDKChannelMonitorUpdate update_var = *update;
6784 update_var = ChannelMonitorUpdate_clone(update);
6785 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6786 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6787 uint64_t update_ref = (uint64_t)update_var.inner;
6788 if (update_var.is_owned) {
6791 LDKChannelMonitor data_var = *data;
6792 data_var = ChannelMonitor_clone(data);
6793 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6794 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6795 uint64_t data_ref = (uint64_t)data_var.inner;
6796 if (data_var.is_owned) {
6799 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6801 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
6802 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6803 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6804 if (get_jenv_res == JNI_EDETACHED) {
6805 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6809 static void* LDKPersist_JCalls_clone(const void* this_arg) {
6810 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6811 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6812 return (void*) this_arg;
6814 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
6815 jclass c = (*env)->GetObjectClass(env, o);
6817 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6818 atomic_init(&calls->refcnt, 1);
6819 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6820 calls->o = (*env)->NewWeakGlobalRef(env, o);
6821 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
6822 CHECK(calls->persist_new_channel_meth != NULL);
6823 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
6824 CHECK(calls->update_persisted_channel_meth != NULL);
6827 .this_arg = (void*) calls,
6828 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6829 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6830 .free = LDKPersist_JCalls_free,
6834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
6835 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6836 *res_ptr = LDKPersist_init(env, clz, o);
6837 return (uint64_t)res_ptr;
6839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t data) {
6840 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
6841 LDKOutPoint id_conv;
6842 id_conv.inner = (void*)(id & (~1));
6843 id_conv.is_owned = (id & 1) || (id == 0);
6844 id_conv = OutPoint_clone(&id_conv);
6845 LDKChannelMonitor data_conv;
6846 data_conv.inner = (void*)(data & (~1));
6847 data_conv.is_owned = false;
6848 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6849 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
6850 return (uint64_t)ret_conv;
6853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t update, int64_t data) {
6854 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
6855 LDKOutPoint id_conv;
6856 id_conv.inner = (void*)(id & (~1));
6857 id_conv.is_owned = (id & 1) || (id == 0);
6858 id_conv = OutPoint_clone(&id_conv);
6859 LDKChannelMonitorUpdate update_conv;
6860 update_conv.inner = (void*)(update & (~1));
6861 update_conv.is_owned = false;
6862 LDKChannelMonitor data_conv;
6863 data_conv.inner = (void*)(data & (~1));
6864 data_conv.is_owned = false;
6865 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6866 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
6867 return (uint64_t)ret_conv;
6870 typedef struct LDKChannelMessageHandler_JCalls {
6871 atomic_size_t refcnt;
6874 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6875 jmethodID handle_open_channel_meth;
6876 jmethodID handle_accept_channel_meth;
6877 jmethodID handle_funding_created_meth;
6878 jmethodID handle_funding_signed_meth;
6879 jmethodID handle_funding_locked_meth;
6880 jmethodID handle_shutdown_meth;
6881 jmethodID handle_closing_signed_meth;
6882 jmethodID handle_update_add_htlc_meth;
6883 jmethodID handle_update_fulfill_htlc_meth;
6884 jmethodID handle_update_fail_htlc_meth;
6885 jmethodID handle_update_fail_malformed_htlc_meth;
6886 jmethodID handle_commitment_signed_meth;
6887 jmethodID handle_revoke_and_ack_meth;
6888 jmethodID handle_update_fee_meth;
6889 jmethodID handle_announcement_signatures_meth;
6890 jmethodID peer_disconnected_meth;
6891 jmethodID peer_connected_meth;
6892 jmethodID handle_channel_reestablish_meth;
6893 jmethodID handle_channel_update_meth;
6894 jmethodID handle_error_meth;
6895 } LDKChannelMessageHandler_JCalls;
6896 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6897 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6898 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6900 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6901 if (get_jenv_res == JNI_EDETACHED) {
6902 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6904 DO_ASSERT(get_jenv_res == JNI_OK);
6906 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6907 if (get_jenv_res == JNI_EDETACHED) {
6908 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6913 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
6914 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6916 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6917 if (get_jenv_res == JNI_EDETACHED) {
6918 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6920 DO_ASSERT(get_jenv_res == JNI_OK);
6922 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6923 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6924 LDKInitFeatures their_features_var = their_features;
6925 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6926 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6927 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6928 if (their_features_var.is_owned) {
6929 their_features_ref |= 1;
6931 LDKOpenChannel msg_var = *msg;
6932 msg_var = OpenChannel_clone(msg);
6933 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6934 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6935 uint64_t msg_ref = (uint64_t)msg_var.inner;
6936 if (msg_var.is_owned) {
6939 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6941 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6942 if (get_jenv_res == JNI_EDETACHED) {
6943 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6946 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6947 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6949 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6950 if (get_jenv_res == JNI_EDETACHED) {
6951 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6953 DO_ASSERT(get_jenv_res == JNI_OK);
6955 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6956 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6957 LDKInitFeatures their_features_var = their_features;
6958 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6959 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6960 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6961 if (their_features_var.is_owned) {
6962 their_features_ref |= 1;
6964 LDKAcceptChannel msg_var = *msg;
6965 msg_var = AcceptChannel_clone(msg);
6966 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6967 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6968 uint64_t msg_ref = (uint64_t)msg_var.inner;
6969 if (msg_var.is_owned) {
6972 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6974 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6975 if (get_jenv_res == JNI_EDETACHED) {
6976 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6979 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6980 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6982 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6983 if (get_jenv_res == JNI_EDETACHED) {
6984 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6986 DO_ASSERT(get_jenv_res == JNI_OK);
6988 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6989 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6990 LDKFundingCreated msg_var = *msg;
6991 msg_var = FundingCreated_clone(msg);
6992 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6993 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6994 uint64_t msg_ref = (uint64_t)msg_var.inner;
6995 if (msg_var.is_owned) {
6998 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7000 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
7001 if (get_jenv_res == JNI_EDETACHED) {
7002 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7005 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7006 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7008 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7009 if (get_jenv_res == JNI_EDETACHED) {
7010 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7012 DO_ASSERT(get_jenv_res == JNI_OK);
7014 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7015 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7016 LDKFundingSigned msg_var = *msg;
7017 msg_var = FundingSigned_clone(msg);
7018 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7019 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7020 uint64_t msg_ref = (uint64_t)msg_var.inner;
7021 if (msg_var.is_owned) {
7024 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7026 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
7027 if (get_jenv_res == JNI_EDETACHED) {
7028 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7031 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7032 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7034 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7035 if (get_jenv_res == JNI_EDETACHED) {
7036 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7038 DO_ASSERT(get_jenv_res == JNI_OK);
7040 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7041 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7042 LDKFundingLocked msg_var = *msg;
7043 msg_var = FundingLocked_clone(msg);
7044 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7045 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7046 uint64_t msg_ref = (uint64_t)msg_var.inner;
7047 if (msg_var.is_owned) {
7050 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7052 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
7053 if (get_jenv_res == JNI_EDETACHED) {
7054 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7057 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7058 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7060 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7061 if (get_jenv_res == JNI_EDETACHED) {
7062 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7064 DO_ASSERT(get_jenv_res == JNI_OK);
7066 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7067 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7068 LDKInitFeatures their_features_var = *their_features;
7069 their_features_var = InitFeatures_clone(their_features);
7070 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7071 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7072 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7073 if (their_features_var.is_owned) {
7074 their_features_ref |= 1;
7076 LDKShutdown msg_var = *msg;
7077 msg_var = Shutdown_clone(msg);
7078 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7079 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7080 uint64_t msg_ref = (uint64_t)msg_var.inner;
7081 if (msg_var.is_owned) {
7084 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7086 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
7087 if (get_jenv_res == JNI_EDETACHED) {
7088 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7091 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7092 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7094 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7095 if (get_jenv_res == JNI_EDETACHED) {
7096 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7098 DO_ASSERT(get_jenv_res == JNI_OK);
7100 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7101 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7102 LDKClosingSigned msg_var = *msg;
7103 msg_var = ClosingSigned_clone(msg);
7104 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7105 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7106 uint64_t msg_ref = (uint64_t)msg_var.inner;
7107 if (msg_var.is_owned) {
7110 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7112 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
7113 if (get_jenv_res == JNI_EDETACHED) {
7114 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7117 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7118 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7120 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7121 if (get_jenv_res == JNI_EDETACHED) {
7122 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7124 DO_ASSERT(get_jenv_res == JNI_OK);
7126 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7127 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7128 LDKUpdateAddHTLC msg_var = *msg;
7129 msg_var = UpdateAddHTLC_clone(msg);
7130 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7131 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7132 uint64_t msg_ref = (uint64_t)msg_var.inner;
7133 if (msg_var.is_owned) {
7136 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7138 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
7139 if (get_jenv_res == JNI_EDETACHED) {
7140 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7143 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7144 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7146 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7147 if (get_jenv_res == JNI_EDETACHED) {
7148 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7150 DO_ASSERT(get_jenv_res == JNI_OK);
7152 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7153 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7154 LDKUpdateFulfillHTLC msg_var = *msg;
7155 msg_var = UpdateFulfillHTLC_clone(msg);
7156 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7157 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7158 uint64_t msg_ref = (uint64_t)msg_var.inner;
7159 if (msg_var.is_owned) {
7162 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7164 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
7165 if (get_jenv_res == JNI_EDETACHED) {
7166 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7169 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7170 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7172 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7173 if (get_jenv_res == JNI_EDETACHED) {
7174 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7176 DO_ASSERT(get_jenv_res == JNI_OK);
7178 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7179 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7180 LDKUpdateFailHTLC msg_var = *msg;
7181 msg_var = UpdateFailHTLC_clone(msg);
7182 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7183 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7184 uint64_t msg_ref = (uint64_t)msg_var.inner;
7185 if (msg_var.is_owned) {
7188 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7190 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
7191 if (get_jenv_res == JNI_EDETACHED) {
7192 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7195 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7196 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7198 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7199 if (get_jenv_res == JNI_EDETACHED) {
7200 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7202 DO_ASSERT(get_jenv_res == JNI_OK);
7204 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7205 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7206 LDKUpdateFailMalformedHTLC msg_var = *msg;
7207 msg_var = UpdateFailMalformedHTLC_clone(msg);
7208 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7209 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7210 uint64_t msg_ref = (uint64_t)msg_var.inner;
7211 if (msg_var.is_owned) {
7214 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7216 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
7217 if (get_jenv_res == JNI_EDETACHED) {
7218 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7221 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7222 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7224 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7225 if (get_jenv_res == JNI_EDETACHED) {
7226 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7228 DO_ASSERT(get_jenv_res == JNI_OK);
7230 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7231 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7232 LDKCommitmentSigned msg_var = *msg;
7233 msg_var = CommitmentSigned_clone(msg);
7234 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7235 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7236 uint64_t msg_ref = (uint64_t)msg_var.inner;
7237 if (msg_var.is_owned) {
7240 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7242 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
7243 if (get_jenv_res == JNI_EDETACHED) {
7244 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7247 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7248 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7250 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7251 if (get_jenv_res == JNI_EDETACHED) {
7252 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7254 DO_ASSERT(get_jenv_res == JNI_OK);
7256 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7257 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7258 LDKRevokeAndACK msg_var = *msg;
7259 msg_var = RevokeAndACK_clone(msg);
7260 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7261 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7262 uint64_t msg_ref = (uint64_t)msg_var.inner;
7263 if (msg_var.is_owned) {
7266 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7268 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
7269 if (get_jenv_res == JNI_EDETACHED) {
7270 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7273 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7274 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7276 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7277 if (get_jenv_res == JNI_EDETACHED) {
7278 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7280 DO_ASSERT(get_jenv_res == JNI_OK);
7282 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7283 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7284 LDKUpdateFee msg_var = *msg;
7285 msg_var = UpdateFee_clone(msg);
7286 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7287 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7288 uint64_t msg_ref = (uint64_t)msg_var.inner;
7289 if (msg_var.is_owned) {
7292 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7294 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
7295 if (get_jenv_res == JNI_EDETACHED) {
7296 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7299 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7300 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7302 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7303 if (get_jenv_res == JNI_EDETACHED) {
7304 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7306 DO_ASSERT(get_jenv_res == JNI_OK);
7308 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7309 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7310 LDKAnnouncementSignatures msg_var = *msg;
7311 msg_var = AnnouncementSignatures_clone(msg);
7312 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7313 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7314 uint64_t msg_ref = (uint64_t)msg_var.inner;
7315 if (msg_var.is_owned) {
7318 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7320 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
7321 if (get_jenv_res == JNI_EDETACHED) {
7322 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7325 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7326 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7328 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7329 if (get_jenv_res == JNI_EDETACHED) {
7330 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7332 DO_ASSERT(get_jenv_res == JNI_OK);
7334 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7335 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7336 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7338 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
7339 if (get_jenv_res == JNI_EDETACHED) {
7340 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7343 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7344 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7346 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7347 if (get_jenv_res == JNI_EDETACHED) {
7348 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7350 DO_ASSERT(get_jenv_res == JNI_OK);
7352 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7353 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7354 LDKInit msg_var = *msg;
7355 msg_var = Init_clone(msg);
7356 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7357 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7358 uint64_t msg_ref = (uint64_t)msg_var.inner;
7359 if (msg_var.is_owned) {
7362 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7364 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
7365 if (get_jenv_res == JNI_EDETACHED) {
7366 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7369 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7370 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7372 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7373 if (get_jenv_res == JNI_EDETACHED) {
7374 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7376 DO_ASSERT(get_jenv_res == JNI_OK);
7378 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7379 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7380 LDKChannelReestablish msg_var = *msg;
7381 msg_var = ChannelReestablish_clone(msg);
7382 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7383 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7384 uint64_t msg_ref = (uint64_t)msg_var.inner;
7385 if (msg_var.is_owned) {
7388 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7390 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
7391 if (get_jenv_res == JNI_EDETACHED) {
7392 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7395 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7396 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7398 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7399 if (get_jenv_res == JNI_EDETACHED) {
7400 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7402 DO_ASSERT(get_jenv_res == JNI_OK);
7404 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7405 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7406 LDKChannelUpdate msg_var = *msg;
7407 msg_var = ChannelUpdate_clone(msg);
7408 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7409 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7410 uint64_t msg_ref = (uint64_t)msg_var.inner;
7411 if (msg_var.is_owned) {
7414 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7416 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
7417 if (get_jenv_res == JNI_EDETACHED) {
7418 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7421 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7422 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7424 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7425 if (get_jenv_res == JNI_EDETACHED) {
7426 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7428 DO_ASSERT(get_jenv_res == JNI_OK);
7430 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7431 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7432 LDKErrorMessage msg_var = *msg;
7433 msg_var = ErrorMessage_clone(msg);
7434 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7435 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7436 uint64_t msg_ref = (uint64_t)msg_var.inner;
7437 if (msg_var.is_owned) {
7440 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7442 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
7443 if (get_jenv_res == JNI_EDETACHED) {
7444 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7447 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
7448 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7449 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7450 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7451 return (void*) this_arg;
7453 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7454 jclass c = (*env)->GetObjectClass(env, o);
7456 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7457 atomic_init(&calls->refcnt, 1);
7458 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7459 calls->o = (*env)->NewWeakGlobalRef(env, o);
7460 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
7461 CHECK(calls->handle_open_channel_meth != NULL);
7462 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
7463 CHECK(calls->handle_accept_channel_meth != NULL);
7464 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
7465 CHECK(calls->handle_funding_created_meth != NULL);
7466 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
7467 CHECK(calls->handle_funding_signed_meth != NULL);
7468 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
7469 CHECK(calls->handle_funding_locked_meth != NULL);
7470 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
7471 CHECK(calls->handle_shutdown_meth != NULL);
7472 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
7473 CHECK(calls->handle_closing_signed_meth != NULL);
7474 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
7475 CHECK(calls->handle_update_add_htlc_meth != NULL);
7476 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
7477 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
7478 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
7479 CHECK(calls->handle_update_fail_htlc_meth != NULL);
7480 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
7481 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
7482 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
7483 CHECK(calls->handle_commitment_signed_meth != NULL);
7484 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
7485 CHECK(calls->handle_revoke_and_ack_meth != NULL);
7486 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
7487 CHECK(calls->handle_update_fee_meth != NULL);
7488 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
7489 CHECK(calls->handle_announcement_signatures_meth != NULL);
7490 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
7491 CHECK(calls->peer_disconnected_meth != NULL);
7492 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
7493 CHECK(calls->peer_connected_meth != NULL);
7494 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
7495 CHECK(calls->handle_channel_reestablish_meth != NULL);
7496 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
7497 CHECK(calls->handle_channel_update_meth != NULL);
7498 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
7499 CHECK(calls->handle_error_meth != NULL);
7501 LDKChannelMessageHandler ret = {
7502 .this_arg = (void*) calls,
7503 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7504 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7505 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7506 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7507 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7508 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7509 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7510 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7511 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7512 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7513 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7514 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7515 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7516 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7517 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7518 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7519 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7520 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7521 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7522 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7523 .free = LDKChannelMessageHandler_JCalls_free,
7524 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
7526 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7530 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7531 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
7532 return (uint64_t)res_ptr;
7534 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) {
7535 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7536 LDKPublicKey their_node_id_ref;
7537 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7538 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7539 LDKInitFeatures their_features_conv;
7540 their_features_conv.inner = (void*)(their_features & (~1));
7541 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7542 their_features_conv = InitFeatures_clone(&their_features_conv);
7543 LDKOpenChannel msg_conv;
7544 msg_conv.inner = (void*)(msg & (~1));
7545 msg_conv.is_owned = false;
7546 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7549 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) {
7550 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7551 LDKPublicKey their_node_id_ref;
7552 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7553 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7554 LDKInitFeatures their_features_conv;
7555 their_features_conv.inner = (void*)(their_features & (~1));
7556 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7557 their_features_conv = InitFeatures_clone(&their_features_conv);
7558 LDKAcceptChannel msg_conv;
7559 msg_conv.inner = (void*)(msg & (~1));
7560 msg_conv.is_owned = false;
7561 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7564 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) {
7565 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7566 LDKPublicKey their_node_id_ref;
7567 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7568 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7569 LDKFundingCreated msg_conv;
7570 msg_conv.inner = (void*)(msg & (~1));
7571 msg_conv.is_owned = false;
7572 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7575 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) {
7576 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7577 LDKPublicKey their_node_id_ref;
7578 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7579 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7580 LDKFundingSigned msg_conv;
7581 msg_conv.inner = (void*)(msg & (~1));
7582 msg_conv.is_owned = false;
7583 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7586 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) {
7587 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7588 LDKPublicKey their_node_id_ref;
7589 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7590 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7591 LDKFundingLocked msg_conv;
7592 msg_conv.inner = (void*)(msg & (~1));
7593 msg_conv.is_owned = false;
7594 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7597 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) {
7598 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7599 LDKPublicKey their_node_id_ref;
7600 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7601 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7602 LDKInitFeatures their_features_conv;
7603 their_features_conv.inner = (void*)(their_features & (~1));
7604 their_features_conv.is_owned = false;
7605 LDKShutdown msg_conv;
7606 msg_conv.inner = (void*)(msg & (~1));
7607 msg_conv.is_owned = false;
7608 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7611 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) {
7612 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7613 LDKPublicKey their_node_id_ref;
7614 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7615 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7616 LDKClosingSigned msg_conv;
7617 msg_conv.inner = (void*)(msg & (~1));
7618 msg_conv.is_owned = false;
7619 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7622 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) {
7623 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7624 LDKPublicKey their_node_id_ref;
7625 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7626 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7627 LDKUpdateAddHTLC msg_conv;
7628 msg_conv.inner = (void*)(msg & (~1));
7629 msg_conv.is_owned = false;
7630 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7633 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) {
7634 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7635 LDKPublicKey their_node_id_ref;
7636 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7637 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7638 LDKUpdateFulfillHTLC msg_conv;
7639 msg_conv.inner = (void*)(msg & (~1));
7640 msg_conv.is_owned = false;
7641 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7644 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) {
7645 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7646 LDKPublicKey their_node_id_ref;
7647 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7648 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7649 LDKUpdateFailHTLC msg_conv;
7650 msg_conv.inner = (void*)(msg & (~1));
7651 msg_conv.is_owned = false;
7652 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7655 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) {
7656 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7657 LDKPublicKey their_node_id_ref;
7658 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7659 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7660 LDKUpdateFailMalformedHTLC msg_conv;
7661 msg_conv.inner = (void*)(msg & (~1));
7662 msg_conv.is_owned = false;
7663 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7666 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) {
7667 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7668 LDKPublicKey their_node_id_ref;
7669 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7670 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7671 LDKCommitmentSigned msg_conv;
7672 msg_conv.inner = (void*)(msg & (~1));
7673 msg_conv.is_owned = false;
7674 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7677 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) {
7678 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7679 LDKPublicKey their_node_id_ref;
7680 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7681 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7682 LDKRevokeAndACK msg_conv;
7683 msg_conv.inner = (void*)(msg & (~1));
7684 msg_conv.is_owned = false;
7685 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7688 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) {
7689 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7690 LDKPublicKey their_node_id_ref;
7691 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7692 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7693 LDKUpdateFee msg_conv;
7694 msg_conv.inner = (void*)(msg & (~1));
7695 msg_conv.is_owned = false;
7696 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7699 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) {
7700 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7701 LDKPublicKey their_node_id_ref;
7702 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7703 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7704 LDKAnnouncementSignatures msg_conv;
7705 msg_conv.inner = (void*)(msg & (~1));
7706 msg_conv.is_owned = false;
7707 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7710 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) {
7711 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7712 LDKPublicKey their_node_id_ref;
7713 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7714 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7715 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7718 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) {
7719 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7720 LDKPublicKey their_node_id_ref;
7721 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7722 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7724 msg_conv.inner = (void*)(msg & (~1));
7725 msg_conv.is_owned = false;
7726 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7729 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) {
7730 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7731 LDKPublicKey their_node_id_ref;
7732 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7733 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7734 LDKChannelReestablish msg_conv;
7735 msg_conv.inner = (void*)(msg & (~1));
7736 msg_conv.is_owned = false;
7737 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7740 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) {
7741 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7742 LDKPublicKey their_node_id_ref;
7743 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7744 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7745 LDKChannelUpdate msg_conv;
7746 msg_conv.inner = (void*)(msg & (~1));
7747 msg_conv.is_owned = false;
7748 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7751 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) {
7752 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7753 LDKPublicKey their_node_id_ref;
7754 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7755 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7756 LDKErrorMessage msg_conv;
7757 msg_conv.inner = (void*)(msg & (~1));
7758 msg_conv.is_owned = false;
7759 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7762 typedef struct LDKRoutingMessageHandler_JCalls {
7763 atomic_size_t refcnt;
7766 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7767 jmethodID handle_node_announcement_meth;
7768 jmethodID handle_channel_announcement_meth;
7769 jmethodID handle_channel_update_meth;
7770 jmethodID handle_htlc_fail_channel_update_meth;
7771 jmethodID get_next_channel_announcements_meth;
7772 jmethodID get_next_node_announcements_meth;
7773 jmethodID sync_routing_table_meth;
7774 jmethodID handle_reply_channel_range_meth;
7775 jmethodID handle_reply_short_channel_ids_end_meth;
7776 jmethodID handle_query_channel_range_meth;
7777 jmethodID handle_query_short_channel_ids_meth;
7778 } LDKRoutingMessageHandler_JCalls;
7779 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
7780 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7781 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7783 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7784 if (get_jenv_res == JNI_EDETACHED) {
7785 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7787 DO_ASSERT(get_jenv_res == JNI_OK);
7789 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7790 if (get_jenv_res == JNI_EDETACHED) {
7791 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7796 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
7797 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7799 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7800 if (get_jenv_res == JNI_EDETACHED) {
7801 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7803 DO_ASSERT(get_jenv_res == JNI_OK);
7805 LDKNodeAnnouncement msg_var = *msg;
7806 msg_var = NodeAnnouncement_clone(msg);
7807 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7808 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7809 uint64_t msg_ref = (uint64_t)msg_var.inner;
7810 if (msg_var.is_owned) {
7813 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7815 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
7816 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7817 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7818 if (get_jenv_res == JNI_EDETACHED) {
7819 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7823 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
7824 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7826 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7827 if (get_jenv_res == JNI_EDETACHED) {
7828 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7830 DO_ASSERT(get_jenv_res == JNI_OK);
7832 LDKChannelAnnouncement msg_var = *msg;
7833 msg_var = ChannelAnnouncement_clone(msg);
7834 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7835 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7836 uint64_t msg_ref = (uint64_t)msg_var.inner;
7837 if (msg_var.is_owned) {
7840 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7842 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
7843 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7844 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7845 if (get_jenv_res == JNI_EDETACHED) {
7846 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7850 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
7851 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7853 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7854 if (get_jenv_res == JNI_EDETACHED) {
7855 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7857 DO_ASSERT(get_jenv_res == JNI_OK);
7859 LDKChannelUpdate msg_var = *msg;
7860 msg_var = ChannelUpdate_clone(msg);
7861 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7862 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7863 uint64_t msg_ref = (uint64_t)msg_var.inner;
7864 if (msg_var.is_owned) {
7867 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7869 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
7870 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7871 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7872 if (get_jenv_res == JNI_EDETACHED) {
7873 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7877 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
7878 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7880 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7881 if (get_jenv_res == JNI_EDETACHED) {
7882 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7884 DO_ASSERT(get_jenv_res == JNI_OK);
7886 uint64_t ret_update = (uint64_t)update;
7887 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7889 (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
7890 if (get_jenv_res == JNI_EDETACHED) {
7891 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7894 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
7895 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7897 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7898 if (get_jenv_res == JNI_EDETACHED) {
7899 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7901 DO_ASSERT(get_jenv_res == JNI_OK);
7903 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7905 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
7906 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
7907 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7908 if (ret_constr.datalen > 0)
7909 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
7911 ret_constr.data = NULL;
7912 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7913 for (size_t l = 0; l < ret_constr.datalen; l++) {
7914 int64_t ret_conv_63 = ret_vals[l];
7915 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
7916 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
7917 ret_constr.data[l] = ret_conv_63_conv;
7919 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7920 if (get_jenv_res == JNI_EDETACHED) {
7921 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7925 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
7926 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7928 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7929 if (get_jenv_res == JNI_EDETACHED) {
7930 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7932 DO_ASSERT(get_jenv_res == JNI_OK);
7934 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
7935 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
7936 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7938 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
7939 LDKCVec_NodeAnnouncementZ ret_constr;
7940 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7941 if (ret_constr.datalen > 0)
7942 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
7944 ret_constr.data = NULL;
7945 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7946 for (size_t s = 0; s < ret_constr.datalen; s++) {
7947 int64_t ret_conv_18 = ret_vals[s];
7948 LDKNodeAnnouncement ret_conv_18_conv;
7949 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
7950 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
7951 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
7952 ret_constr.data[s] = ret_conv_18_conv;
7954 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7955 if (get_jenv_res == JNI_EDETACHED) {
7956 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7960 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
7961 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7963 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7964 if (get_jenv_res == JNI_EDETACHED) {
7965 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7967 DO_ASSERT(get_jenv_res == JNI_OK);
7969 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7970 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7971 LDKInit init_var = *init;
7972 init_var = Init_clone(init);
7973 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7974 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7975 uint64_t init_ref = (uint64_t)init_var.inner;
7976 if (init_var.is_owned) {
7979 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7981 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
7982 if (get_jenv_res == JNI_EDETACHED) {
7983 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7986 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
7987 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7989 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7990 if (get_jenv_res == JNI_EDETACHED) {
7991 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7993 DO_ASSERT(get_jenv_res == JNI_OK);
7995 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7996 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7997 LDKReplyChannelRange msg_var = msg;
7998 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7999 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8000 uint64_t msg_ref = (uint64_t)msg_var.inner;
8001 if (msg_var.is_owned) {
8004 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8006 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
8007 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8008 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8009 if (get_jenv_res == JNI_EDETACHED) {
8010 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8014 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8015 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8017 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8018 if (get_jenv_res == JNI_EDETACHED) {
8019 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8021 DO_ASSERT(get_jenv_res == JNI_OK);
8023 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8024 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8025 LDKReplyShortChannelIdsEnd msg_var = msg;
8026 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8027 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8028 uint64_t msg_ref = (uint64_t)msg_var.inner;
8029 if (msg_var.is_owned) {
8032 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8034 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
8035 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8036 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8037 if (get_jenv_res == JNI_EDETACHED) {
8038 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8042 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8043 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8045 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8046 if (get_jenv_res == JNI_EDETACHED) {
8047 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8049 DO_ASSERT(get_jenv_res == JNI_OK);
8051 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8052 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8053 LDKQueryChannelRange msg_var = msg;
8054 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8055 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8056 uint64_t msg_ref = (uint64_t)msg_var.inner;
8057 if (msg_var.is_owned) {
8060 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8062 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
8063 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8064 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8065 if (get_jenv_res == JNI_EDETACHED) {
8066 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8070 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8071 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8073 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8074 if (get_jenv_res == JNI_EDETACHED) {
8075 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8077 DO_ASSERT(get_jenv_res == JNI_OK);
8079 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8080 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8081 LDKQueryShortChannelIds msg_var = msg;
8082 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8083 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8084 uint64_t msg_ref = (uint64_t)msg_var.inner;
8085 if (msg_var.is_owned) {
8088 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8090 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
8091 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8092 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8093 if (get_jenv_res == JNI_EDETACHED) {
8094 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8098 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
8099 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8100 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8101 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8102 return (void*) this_arg;
8104 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8105 jclass c = (*env)->GetObjectClass(env, o);
8107 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8108 atomic_init(&calls->refcnt, 1);
8109 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8110 calls->o = (*env)->NewWeakGlobalRef(env, o);
8111 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
8112 CHECK(calls->handle_node_announcement_meth != NULL);
8113 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
8114 CHECK(calls->handle_channel_announcement_meth != NULL);
8115 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
8116 CHECK(calls->handle_channel_update_meth != NULL);
8117 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
8118 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
8119 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
8120 CHECK(calls->get_next_channel_announcements_meth != NULL);
8121 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
8122 CHECK(calls->get_next_node_announcements_meth != NULL);
8123 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
8124 CHECK(calls->sync_routing_table_meth != NULL);
8125 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
8126 CHECK(calls->handle_reply_channel_range_meth != NULL);
8127 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
8128 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
8129 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
8130 CHECK(calls->handle_query_channel_range_meth != NULL);
8131 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
8132 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
8134 LDKRoutingMessageHandler ret = {
8135 .this_arg = (void*) calls,
8136 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8137 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8138 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8139 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
8140 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8141 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8142 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8143 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8144 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8145 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8146 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8147 .free = LDKRoutingMessageHandler_JCalls_free,
8148 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8150 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8154 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8155 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8156 return (uint64_t)res_ptr;
8158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8159 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8160 LDKNodeAnnouncement msg_conv;
8161 msg_conv.inner = (void*)(msg & (~1));
8162 msg_conv.is_owned = false;
8163 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8164 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8165 return (uint64_t)ret_conv;
8168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8169 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8170 LDKChannelAnnouncement msg_conv;
8171 msg_conv.inner = (void*)(msg & (~1));
8172 msg_conv.is_owned = false;
8173 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8174 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8175 return (uint64_t)ret_conv;
8178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8179 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8180 LDKChannelUpdate msg_conv;
8181 msg_conv.inner = (void*)(msg & (~1));
8182 msg_conv.is_owned = false;
8183 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8184 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8185 return (uint64_t)ret_conv;
8188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
8189 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8190 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
8191 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
8194 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) {
8195 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8196 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8197 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8198 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8199 for (size_t l = 0; l < ret_var.datalen; l++) {
8200 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8201 *ret_conv_63_ref = ret_var.data[l];
8202 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
8204 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8209 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) {
8210 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8211 LDKPublicKey starting_point_ref;
8212 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
8213 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
8214 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8215 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8216 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8217 for (size_t s = 0; s < ret_var.datalen; s++) {
8218 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8219 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8220 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8221 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8222 if (ret_conv_18_var.is_owned) {
8223 ret_conv_18_ref |= 1;
8225 ret_arr_ptr[s] = ret_conv_18_ref;
8227 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8232 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) {
8233 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8234 LDKPublicKey their_node_id_ref;
8235 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8236 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8238 init_conv.inner = (void*)(init & (~1));
8239 init_conv.is_owned = false;
8240 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8243 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) {
8244 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8245 LDKPublicKey their_node_id_ref;
8246 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8247 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8248 LDKReplyChannelRange msg_conv;
8249 msg_conv.inner = (void*)(msg & (~1));
8250 msg_conv.is_owned = (msg & 1) || (msg == 0);
8251 msg_conv = ReplyChannelRange_clone(&msg_conv);
8252 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8253 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8254 return (uint64_t)ret_conv;
8257 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) {
8258 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8259 LDKPublicKey their_node_id_ref;
8260 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8261 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8262 LDKReplyShortChannelIdsEnd msg_conv;
8263 msg_conv.inner = (void*)(msg & (~1));
8264 msg_conv.is_owned = (msg & 1) || (msg == 0);
8265 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8266 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8267 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8268 return (uint64_t)ret_conv;
8271 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) {
8272 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8273 LDKPublicKey their_node_id_ref;
8274 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8275 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8276 LDKQueryChannelRange msg_conv;
8277 msg_conv.inner = (void*)(msg & (~1));
8278 msg_conv.is_owned = (msg & 1) || (msg == 0);
8279 msg_conv = QueryChannelRange_clone(&msg_conv);
8280 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8281 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8282 return (uint64_t)ret_conv;
8285 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) {
8286 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8287 LDKPublicKey their_node_id_ref;
8288 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8289 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8290 LDKQueryShortChannelIds msg_conv;
8291 msg_conv.inner = (void*)(msg & (~1));
8292 msg_conv.is_owned = (msg & 1) || (msg == 0);
8293 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8294 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8295 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8296 return (uint64_t)ret_conv;
8299 typedef struct LDKSocketDescriptor_JCalls {
8300 atomic_size_t refcnt;
8303 jmethodID send_data_meth;
8304 jmethodID disconnect_socket_meth;
8306 jmethodID hash_meth;
8307 } LDKSocketDescriptor_JCalls;
8308 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8309 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8310 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8312 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8313 if (get_jenv_res == JNI_EDETACHED) {
8314 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8316 DO_ASSERT(get_jenv_res == JNI_OK);
8318 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8319 if (get_jenv_res == JNI_EDETACHED) {
8320 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8325 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8326 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8328 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8329 if (get_jenv_res == JNI_EDETACHED) {
8330 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8332 DO_ASSERT(get_jenv_res == JNI_OK);
8334 LDKu8slice data_var = data;
8335 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
8336 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
8337 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8339 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
8340 if (get_jenv_res == JNI_EDETACHED) {
8341 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8345 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8346 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8348 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8349 if (get_jenv_res == JNI_EDETACHED) {
8350 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8352 DO_ASSERT(get_jenv_res == JNI_OK);
8354 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8356 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
8357 if (get_jenv_res == JNI_EDETACHED) {
8358 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8361 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8362 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8364 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8365 if (get_jenv_res == JNI_EDETACHED) {
8366 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8368 DO_ASSERT(get_jenv_res == JNI_OK);
8370 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8371 *other_arg_clone = SocketDescriptor_clone(other_arg);
8372 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8374 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
8375 if (get_jenv_res == JNI_EDETACHED) {
8376 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8380 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8381 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8383 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8384 if (get_jenv_res == JNI_EDETACHED) {
8385 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8387 DO_ASSERT(get_jenv_res == JNI_OK);
8389 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8391 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
8392 if (get_jenv_res == JNI_EDETACHED) {
8393 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8397 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
8398 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8399 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8400 return (void*) this_arg;
8402 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
8403 jclass c = (*env)->GetObjectClass(env, o);
8405 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8406 atomic_init(&calls->refcnt, 1);
8407 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8408 calls->o = (*env)->NewWeakGlobalRef(env, o);
8409 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
8410 CHECK(calls->send_data_meth != NULL);
8411 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
8412 CHECK(calls->disconnect_socket_meth != NULL);
8413 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
8414 CHECK(calls->eq_meth != NULL);
8415 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
8416 CHECK(calls->hash_meth != NULL);
8418 LDKSocketDescriptor ret = {
8419 .this_arg = (void*) calls,
8420 .send_data = send_data_LDKSocketDescriptor_jcall,
8421 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8422 .eq = eq_LDKSocketDescriptor_jcall,
8423 .hash = hash_LDKSocketDescriptor_jcall,
8424 .clone = LDKSocketDescriptor_JCalls_clone,
8425 .free = LDKSocketDescriptor_JCalls_free,
8429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
8430 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8431 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
8432 return (uint64_t)res_ptr;
8434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray data, jboolean resume_read) {
8435 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8436 LDKu8slice data_ref;
8437 data_ref.datalen = (*env)->GetArrayLength(env, data);
8438 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
8439 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8440 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
8444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
8445 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8446 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
8450 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8451 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8455 typedef struct LDKChannelManagerPersister_JCalls {
8456 atomic_size_t refcnt;
8459 jmethodID persist_manager_meth;
8460 } LDKChannelManagerPersister_JCalls;
8461 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
8462 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8463 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8465 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8466 if (get_jenv_res == JNI_EDETACHED) {
8467 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8469 DO_ASSERT(get_jenv_res == JNI_OK);
8471 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8472 if (get_jenv_res == JNI_EDETACHED) {
8473 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8478 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8479 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8481 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8482 if (get_jenv_res == JNI_EDETACHED) {
8483 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8485 DO_ASSERT(get_jenv_res == JNI_OK);
8487 LDKChannelManager channel_manager_var = *channel_manager;
8488 // Warning: we may need a move here but no clone is available for LDKChannelManager
8489 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8490 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8491 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
8492 if (channel_manager_var.is_owned) {
8493 channel_manager_ref |= 1;
8495 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8497 LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
8498 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
8499 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
8500 if (get_jenv_res == JNI_EDETACHED) {
8501 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8505 static void* LDKChannelManagerPersister_JCalls_clone(const void* this_arg) {
8506 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8507 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8508 return (void*) this_arg;
8510 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
8511 jclass c = (*env)->GetObjectClass(env, o);
8513 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
8514 atomic_init(&calls->refcnt, 1);
8515 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8516 calls->o = (*env)->NewWeakGlobalRef(env, o);
8517 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
8518 CHECK(calls->persist_manager_meth != NULL);
8520 LDKChannelManagerPersister ret = {
8521 .this_arg = (void*) calls,
8522 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
8523 .free = LDKChannelManagerPersister_JCalls_free,
8527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
8528 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
8529 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
8530 return (uint64_t)res_ptr;
8532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
8533 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
8534 LDKChannelManager channel_manager_conv;
8535 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8536 channel_manager_conv.is_owned = false;
8537 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8538 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8539 return (uint64_t)ret_conv;
8542 static jclass LDKFallback_SegWitProgram_class = NULL;
8543 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
8544 static jclass LDKFallback_PubKeyHash_class = NULL;
8545 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
8546 static jclass LDKFallback_ScriptHash_class = NULL;
8547 static jmethodID LDKFallback_ScriptHash_meth = NULL;
8548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
8549 LDKFallback_SegWitProgram_class =
8550 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
8551 CHECK(LDKFallback_SegWitProgram_class != NULL);
8552 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
8553 CHECK(LDKFallback_SegWitProgram_meth != NULL);
8554 LDKFallback_PubKeyHash_class =
8555 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
8556 CHECK(LDKFallback_PubKeyHash_class != NULL);
8557 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
8558 CHECK(LDKFallback_PubKeyHash_meth != NULL);
8559 LDKFallback_ScriptHash_class =
8560 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
8561 CHECK(LDKFallback_ScriptHash_class != NULL);
8562 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
8563 CHECK(LDKFallback_ScriptHash_meth != NULL);
8565 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8566 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
8568 case LDKFallback_SegWitProgram: {
8569 uint8_t version_val = obj->seg_wit_program.version._0;
8570 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
8571 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
8572 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
8573 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
8575 case LDKFallback_PubKeyHash: {
8576 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
8577 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
8578 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
8580 case LDKFallback_ScriptHash: {
8581 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
8582 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
8583 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
8588 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8589 LDKStr ret_str = _ldk_get_compiled_version();
8590 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8594 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8595 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8596 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
8601 LDKTransaction _res_ref;
8602 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
8603 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8604 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
8605 _res_ref.data_is_owned = true;
8606 Transaction_free(_res_ref);
8609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
8610 if ((_res & 1) != 0) return;
8611 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
8613 TxOut_free(_res_conv);
8616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8617 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8618 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8619 *ret_ref = TxOut_clone(orig_conv);
8620 return (uint64_t)ret_ref;
8623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
8624 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8630 CHECK((*env)->GetArrayLength(env, o) == 32);
8631 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
8632 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8633 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
8634 return (uint64_t)ret_conv;
8637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8638 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8639 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8640 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
8641 return (uint64_t)ret_conv;
8644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8645 if ((_res & 1) != 0) return;
8646 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
8648 CResult_SecretKeyErrorZ_free(_res_conv);
8651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8653 CHECK((*env)->GetArrayLength(env, o) == 33);
8654 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
8655 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8656 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
8657 return (uint64_t)ret_conv;
8660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8661 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8662 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8663 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
8664 return (uint64_t)ret_conv;
8667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8668 if ((_res & 1) != 0) return;
8669 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
8671 CResult_PublicKeyErrorZ_free(_res_conv);
8674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8675 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8676 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8677 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8678 return (uint64_t)ret_conv;
8681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8682 LDKTxCreationKeys o_conv;
8683 o_conv.inner = (void*)(o & (~1));
8684 o_conv.is_owned = (o & 1) || (o == 0);
8685 o_conv = TxCreationKeys_clone(&o_conv);
8686 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8687 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8688 return (uint64_t)ret_conv;
8691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8692 LDKDecodeError e_conv;
8693 e_conv.inner = (void*)(e & (~1));
8694 e_conv.is_owned = (e & 1) || (e == 0);
8695 e_conv = DecodeError_clone(&e_conv);
8696 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8697 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
8698 return (uint64_t)ret_conv;
8701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8702 if ((_res & 1) != 0) return;
8703 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
8705 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
8708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8709 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
8710 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8711 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
8712 return (uint64_t)ret_conv;
8715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8716 LDKChannelPublicKeys o_conv;
8717 o_conv.inner = (void*)(o & (~1));
8718 o_conv.is_owned = (o & 1) || (o == 0);
8719 o_conv = ChannelPublicKeys_clone(&o_conv);
8720 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8721 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
8722 return (uint64_t)ret_conv;
8725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8726 LDKDecodeError e_conv;
8727 e_conv.inner = (void*)(e & (~1));
8728 e_conv.is_owned = (e & 1) || (e == 0);
8729 e_conv = DecodeError_clone(&e_conv);
8730 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8731 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
8732 return (uint64_t)ret_conv;
8735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8736 if ((_res & 1) != 0) return;
8737 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
8739 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
8742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8743 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
8744 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8745 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
8746 return (uint64_t)ret_conv;
8749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8750 LDKTxCreationKeys o_conv;
8751 o_conv.inner = (void*)(o & (~1));
8752 o_conv.is_owned = (o & 1) || (o == 0);
8753 o_conv = TxCreationKeys_clone(&o_conv);
8754 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8755 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
8756 return (uint64_t)ret_conv;
8759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8760 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8761 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8762 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
8763 return (uint64_t)ret_conv;
8766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8767 if ((_res & 1) != 0) return;
8768 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
8770 CResult_TxCreationKeysErrorZ_free(_res_conv);
8773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8774 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
8775 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8776 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
8777 return (uint64_t)ret_conv;
8780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
8781 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8782 *ret_copy = COption_u32Z_some(o);
8783 uint64_t ret_ref = (uint64_t)ret_copy;
8787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
8788 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8789 *ret_copy = COption_u32Z_none();
8790 uint64_t ret_ref = (uint64_t)ret_copy;
8794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
8795 if ((_res & 1) != 0) return;
8796 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
8798 COption_u32Z_free(_res_conv);
8801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8802 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
8803 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8804 *ret_copy = COption_u32Z_clone(orig_conv);
8805 uint64_t ret_ref = (uint64_t)ret_copy;
8809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8810 LDKHTLCOutputInCommitment o_conv;
8811 o_conv.inner = (void*)(o & (~1));
8812 o_conv.is_owned = (o & 1) || (o == 0);
8813 o_conv = HTLCOutputInCommitment_clone(&o_conv);
8814 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8815 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
8816 return (uint64_t)ret_conv;
8819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8820 LDKDecodeError e_conv;
8821 e_conv.inner = (void*)(e & (~1));
8822 e_conv.is_owned = (e & 1) || (e == 0);
8823 e_conv = DecodeError_clone(&e_conv);
8824 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8825 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
8826 return (uint64_t)ret_conv;
8829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8830 if ((_res & 1) != 0) return;
8831 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
8833 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
8836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8837 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
8838 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8839 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
8840 return (uint64_t)ret_conv;
8843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8844 LDKCounterpartyChannelTransactionParameters o_conv;
8845 o_conv.inner = (void*)(o & (~1));
8846 o_conv.is_owned = (o & 1) || (o == 0);
8847 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
8848 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8849 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8850 return (uint64_t)ret_conv;
8853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8854 LDKDecodeError e_conv;
8855 e_conv.inner = (void*)(e & (~1));
8856 e_conv.is_owned = (e & 1) || (e == 0);
8857 e_conv = DecodeError_clone(&e_conv);
8858 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8859 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
8860 return (uint64_t)ret_conv;
8863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8864 if ((_res & 1) != 0) return;
8865 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
8867 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8871 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8872 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8873 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8874 return (uint64_t)ret_conv;
8877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8878 LDKChannelTransactionParameters o_conv;
8879 o_conv.inner = (void*)(o & (~1));
8880 o_conv.is_owned = (o & 1) || (o == 0);
8881 o_conv = ChannelTransactionParameters_clone(&o_conv);
8882 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8883 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8884 return (uint64_t)ret_conv;
8887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8888 LDKDecodeError e_conv;
8889 e_conv.inner = (void*)(e & (~1));
8890 e_conv.is_owned = (e & 1) || (e == 0);
8891 e_conv = DecodeError_clone(&e_conv);
8892 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8893 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
8894 return (uint64_t)ret_conv;
8897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8898 if ((_res & 1) != 0) return;
8899 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
8901 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8905 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8906 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8907 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8908 return (uint64_t)ret_conv;
8911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8912 LDKCVec_SignatureZ _res_constr;
8913 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8914 if (_res_constr.datalen > 0)
8915 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8917 _res_constr.data = NULL;
8918 for (size_t i = 0; i < _res_constr.datalen; i++) {
8919 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
8920 LDKSignature _res_conv_8_ref;
8921 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
8922 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
8923 _res_constr.data[i] = _res_conv_8_ref;
8925 CVec_SignatureZ_free(_res_constr);
8928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8929 LDKHolderCommitmentTransaction o_conv;
8930 o_conv.inner = (void*)(o & (~1));
8931 o_conv.is_owned = (o & 1) || (o == 0);
8932 o_conv = HolderCommitmentTransaction_clone(&o_conv);
8933 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8934 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
8935 return (uint64_t)ret_conv;
8938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8939 LDKDecodeError e_conv;
8940 e_conv.inner = (void*)(e & (~1));
8941 e_conv.is_owned = (e & 1) || (e == 0);
8942 e_conv = DecodeError_clone(&e_conv);
8943 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8944 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
8945 return (uint64_t)ret_conv;
8948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8949 if ((_res & 1) != 0) return;
8950 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
8952 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
8955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8956 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8957 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8958 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8959 return (uint64_t)ret_conv;
8962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8963 LDKBuiltCommitmentTransaction o_conv;
8964 o_conv.inner = (void*)(o & (~1));
8965 o_conv.is_owned = (o & 1) || (o == 0);
8966 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
8967 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8968 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
8969 return (uint64_t)ret_conv;
8972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8973 LDKDecodeError e_conv;
8974 e_conv.inner = (void*)(e & (~1));
8975 e_conv.is_owned = (e & 1) || (e == 0);
8976 e_conv = DecodeError_clone(&e_conv);
8977 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8978 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
8979 return (uint64_t)ret_conv;
8982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8983 if ((_res & 1) != 0) return;
8984 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
8986 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
8989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8990 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8991 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8992 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8993 return (uint64_t)ret_conv;
8996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8997 LDKCommitmentTransaction o_conv;
8998 o_conv.inner = (void*)(o & (~1));
8999 o_conv.is_owned = (o & 1) || (o == 0);
9000 o_conv = CommitmentTransaction_clone(&o_conv);
9001 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9002 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9003 return (uint64_t)ret_conv;
9006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9007 LDKDecodeError e_conv;
9008 e_conv.inner = (void*)(e & (~1));
9009 e_conv.is_owned = (e & 1) || (e == 0);
9010 e_conv = DecodeError_clone(&e_conv);
9011 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9012 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9013 return (uint64_t)ret_conv;
9016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9017 if ((_res & 1) != 0) return;
9018 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9020 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9024 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9025 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9026 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9027 return (uint64_t)ret_conv;
9030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9031 LDKTrustedCommitmentTransaction o_conv;
9032 o_conv.inner = (void*)(o & (~1));
9033 o_conv.is_owned = (o & 1) || (o == 0);
9034 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9035 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9036 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9037 return (uint64_t)ret_conv;
9040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
9041 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9042 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9043 return (uint64_t)ret_conv;
9046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9047 if ((_res & 1) != 0) return;
9048 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
9050 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9054 LDKCVec_SignatureZ o_constr;
9055 o_constr.datalen = (*env)->GetArrayLength(env, o);
9056 if (o_constr.datalen > 0)
9057 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9059 o_constr.data = NULL;
9060 for (size_t i = 0; i < o_constr.datalen; i++) {
9061 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9062 LDKSignature o_conv_8_ref;
9063 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
9064 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
9065 o_constr.data[i] = o_conv_8_ref;
9067 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9068 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9069 return (uint64_t)ret_conv;
9072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
9073 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9074 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9075 return (uint64_t)ret_conv;
9078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9079 if ((_res & 1) != 0) return;
9080 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
9082 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9086 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9087 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9088 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9089 return (uint64_t)ret_conv;
9092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
9093 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9094 *ret_conv = CResult_NoneErrorZ_ok();
9095 return (uint64_t)ret_conv;
9098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9099 LDKIOError e_conv = LDKIOError_from_java(env, e);
9100 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9101 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9102 return (uint64_t)ret_conv;
9105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9106 if ((_res & 1) != 0) return;
9107 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
9109 CResult_NoneErrorZ_free(_res_conv);
9112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9113 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9114 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9115 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9116 return (uint64_t)ret_conv;
9119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9121 o_conv.inner = (void*)(o & (~1));
9122 o_conv.is_owned = (o & 1) || (o == 0);
9123 o_conv = RouteHop_clone(&o_conv);
9124 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9125 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9126 return (uint64_t)ret_conv;
9129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9130 LDKDecodeError e_conv;
9131 e_conv.inner = (void*)(e & (~1));
9132 e_conv.is_owned = (e & 1) || (e == 0);
9133 e_conv = DecodeError_clone(&e_conv);
9134 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9135 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9136 return (uint64_t)ret_conv;
9139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9140 if ((_res & 1) != 0) return;
9141 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
9143 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9147 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9148 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9149 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9150 return (uint64_t)ret_conv;
9153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9154 LDKCVec_RouteHopZ _res_constr;
9155 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9156 if (_res_constr.datalen > 0)
9157 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9159 _res_constr.data = NULL;
9160 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9161 for (size_t k = 0; k < _res_constr.datalen; k++) {
9162 int64_t _res_conv_10 = _res_vals[k];
9163 LDKRouteHop _res_conv_10_conv;
9164 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9165 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9166 _res_constr.data[k] = _res_conv_10_conv;
9168 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9169 CVec_RouteHopZ_free(_res_constr);
9172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9173 LDKCVec_CVec_RouteHopZZ _res_constr;
9174 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9175 if (_res_constr.datalen > 0)
9176 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9178 _res_constr.data = NULL;
9179 for (size_t m = 0; m < _res_constr.datalen; m++) {
9180 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
9181 LDKCVec_RouteHopZ _res_conv_12_constr;
9182 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
9183 if (_res_conv_12_constr.datalen > 0)
9184 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9186 _res_conv_12_constr.data = NULL;
9187 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
9188 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9189 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9190 LDKRouteHop _res_conv_12_conv_10_conv;
9191 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9192 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9193 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9195 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
9196 _res_constr.data[m] = _res_conv_12_constr;
9198 CVec_CVec_RouteHopZZ_free(_res_constr);
9201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9203 o_conv.inner = (void*)(o & (~1));
9204 o_conv.is_owned = (o & 1) || (o == 0);
9205 o_conv = Route_clone(&o_conv);
9206 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9207 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9208 return (uint64_t)ret_conv;
9211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9212 LDKDecodeError e_conv;
9213 e_conv.inner = (void*)(e & (~1));
9214 e_conv.is_owned = (e & 1) || (e == 0);
9215 e_conv = DecodeError_clone(&e_conv);
9216 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9217 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9218 return (uint64_t)ret_conv;
9221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9222 if ((_res & 1) != 0) return;
9223 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
9225 CResult_RouteDecodeErrorZ_free(_res_conv);
9228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9229 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9230 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9231 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9232 return (uint64_t)ret_conv;
9235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
9236 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9237 *ret_copy = COption_u64Z_some(o);
9238 uint64_t ret_ref = (uint64_t)ret_copy;
9242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
9243 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9244 *ret_copy = COption_u64Z_none();
9245 uint64_t ret_ref = (uint64_t)ret_copy;
9249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9250 if ((_res & 1) != 0) return;
9251 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
9253 COption_u64Z_free(_res_conv);
9256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9257 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9258 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9259 *ret_copy = COption_u64Z_clone(orig_conv);
9260 uint64_t ret_ref = (uint64_t)ret_copy;
9264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9265 LDKCVec_ChannelDetailsZ _res_constr;
9266 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9267 if (_res_constr.datalen > 0)
9268 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9270 _res_constr.data = NULL;
9271 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9272 for (size_t q = 0; q < _res_constr.datalen; q++) {
9273 int64_t _res_conv_16 = _res_vals[q];
9274 LDKChannelDetails _res_conv_16_conv;
9275 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9276 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9277 _res_constr.data[q] = _res_conv_16_conv;
9279 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9280 CVec_ChannelDetailsZ_free(_res_constr);
9283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9284 LDKCVec_RouteHintHopZ _res_constr;
9285 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9286 if (_res_constr.datalen > 0)
9287 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
9289 _res_constr.data = NULL;
9290 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9291 for (size_t o = 0; o < _res_constr.datalen; o++) {
9292 int64_t _res_conv_14 = _res_vals[o];
9293 LDKRouteHintHop _res_conv_14_conv;
9294 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
9295 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
9296 _res_constr.data[o] = _res_conv_14_conv;
9298 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9299 CVec_RouteHintHopZ_free(_res_constr);
9302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9304 o_conv.inner = (void*)(o & (~1));
9305 o_conv.is_owned = (o & 1) || (o == 0);
9306 o_conv = Route_clone(&o_conv);
9307 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9308 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9309 return (uint64_t)ret_conv;
9312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9313 LDKLightningError e_conv;
9314 e_conv.inner = (void*)(e & (~1));
9315 e_conv.is_owned = (e & 1) || (e == 0);
9316 e_conv = LightningError_clone(&e_conv);
9317 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9318 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9319 return (uint64_t)ret_conv;
9322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9323 if ((_res & 1) != 0) return;
9324 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
9326 CResult_RouteLightningErrorZ_free(_res_conv);
9329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9330 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9331 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9332 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9333 return (uint64_t)ret_conv;
9336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9337 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
9338 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9339 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9340 return (uint64_t)ret_conv;
9343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9344 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
9345 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9346 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9347 return (uint64_t)ret_conv;
9350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9351 if ((_res & 1) != 0) return;
9352 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
9354 CResult_TxOutAccessErrorZ_free(_res_conv);
9357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9358 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9359 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9360 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9361 return (uint64_t)ret_conv;
9364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9365 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9366 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9367 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
9368 return (uint64_t)ret_ref;
9371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
9372 LDKTransaction b_ref;
9373 b_ref.datalen = (*env)->GetArrayLength(env, b);
9374 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9375 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
9376 b_ref.data_is_owned = true;
9377 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9378 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
9379 return (uint64_t)ret_ref;
9382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9383 if ((_res & 1) != 0) return;
9384 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
9386 C2Tuple_usizeTransactionZ_free(_res_conv);
9389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9390 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9391 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9392 if (_res_constr.datalen > 0)
9393 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9395 _res_constr.data = NULL;
9396 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9397 for (size_t y = 0; y < _res_constr.datalen; y++) {
9398 int64_t _res_conv_24 = _res_vals[y];
9399 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
9400 FREE((void*)_res_conv_24);
9401 _res_constr.data[y] = _res_conv_24_conv;
9403 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9404 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9408 LDKCVec_TxidZ _res_constr;
9409 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9410 if (_res_constr.datalen > 0)
9411 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9413 _res_constr.data = NULL;
9414 for (size_t i = 0; i < _res_constr.datalen; i++) {
9415 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9416 LDKThirtyTwoBytes _res_conv_8_ref;
9417 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
9418 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
9419 _res_constr.data[i] = _res_conv_8_ref;
9421 CVec_TxidZ_free(_res_constr);
9424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
9425 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9426 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9427 return (uint64_t)ret_conv;
9430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
9431 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
9432 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9433 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9434 return (uint64_t)ret_conv;
9437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9438 if ((_res & 1) != 0) return;
9439 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
9441 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9445 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9446 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9447 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9448 return (uint64_t)ret_conv;
9451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9452 LDKCVec_MonitorEventZ _res_constr;
9453 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9454 if (_res_constr.datalen > 0)
9455 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9457 _res_constr.data = NULL;
9458 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9459 for (size_t o = 0; o < _res_constr.datalen; o++) {
9460 int64_t _res_conv_14 = _res_vals[o];
9461 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
9462 FREE((void*)_res_conv_14);
9463 _res_constr.data[o] = _res_conv_14_conv;
9465 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9466 CVec_MonitorEventZ_free(_res_constr);
9469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
9470 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
9471 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9472 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9473 uint64_t ret_ref = (uint64_t)ret_copy;
9477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
9478 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9479 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
9480 uint64_t ret_ref = (uint64_t)ret_copy;
9484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9485 if ((_res & 1) != 0) return;
9486 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
9488 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
9491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9492 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
9493 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9494 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
9495 uint64_t ret_ref = (uint64_t)ret_copy;
9499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9500 LDKCVec_SpendableOutputDescriptorZ _res_constr;
9501 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9502 if (_res_constr.datalen > 0)
9503 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
9505 _res_constr.data = NULL;
9506 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9507 for (size_t b = 0; b < _res_constr.datalen; b++) {
9508 int64_t _res_conv_27 = _res_vals[b];
9509 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
9510 FREE((void*)_res_conv_27);
9511 _res_constr.data[b] = _res_conv_27_conv;
9513 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9514 CVec_SpendableOutputDescriptorZ_free(_res_constr);
9517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9518 LDKCVec_MessageSendEventZ _res_constr;
9519 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9520 if (_res_constr.datalen > 0)
9521 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9523 _res_constr.data = NULL;
9524 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9525 for (size_t s = 0; s < _res_constr.datalen; s++) {
9526 int64_t _res_conv_18 = _res_vals[s];
9527 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
9528 FREE((void*)_res_conv_18);
9529 _res_constr.data[s] = _res_conv_18_conv;
9531 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9532 CVec_MessageSendEventZ_free(_res_constr);
9535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9536 LDKInitFeatures o_conv;
9537 o_conv.inner = (void*)(o & (~1));
9538 o_conv.is_owned = (o & 1) || (o == 0);
9539 o_conv = InitFeatures_clone(&o_conv);
9540 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9541 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
9542 return (uint64_t)ret_conv;
9545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9546 LDKDecodeError e_conv;
9547 e_conv.inner = (void*)(e & (~1));
9548 e_conv.is_owned = (e & 1) || (e == 0);
9549 e_conv = DecodeError_clone(&e_conv);
9550 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9551 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
9552 return (uint64_t)ret_conv;
9555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9556 if ((_res & 1) != 0) return;
9557 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9559 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
9562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9563 LDKNodeFeatures o_conv;
9564 o_conv.inner = (void*)(o & (~1));
9565 o_conv.is_owned = (o & 1) || (o == 0);
9566 o_conv = NodeFeatures_clone(&o_conv);
9567 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9568 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
9569 return (uint64_t)ret_conv;
9572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9573 LDKDecodeError e_conv;
9574 e_conv.inner = (void*)(e & (~1));
9575 e_conv.is_owned = (e & 1) || (e == 0);
9576 e_conv = DecodeError_clone(&e_conv);
9577 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9578 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
9579 return (uint64_t)ret_conv;
9582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9583 if ((_res & 1) != 0) return;
9584 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9586 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
9589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9590 LDKChannelFeatures o_conv;
9591 o_conv.inner = (void*)(o & (~1));
9592 o_conv.is_owned = (o & 1) || (o == 0);
9593 o_conv = ChannelFeatures_clone(&o_conv);
9594 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9595 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
9596 return (uint64_t)ret_conv;
9599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9600 LDKDecodeError e_conv;
9601 e_conv.inner = (void*)(e & (~1));
9602 e_conv.is_owned = (e & 1) || (e == 0);
9603 e_conv = DecodeError_clone(&e_conv);
9604 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9605 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
9606 return (uint64_t)ret_conv;
9609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9610 if ((_res & 1) != 0) return;
9611 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9613 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
9616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9617 LDKInvoiceFeatures o_conv;
9618 o_conv.inner = (void*)(o & (~1));
9619 o_conv.is_owned = (o & 1) || (o == 0);
9620 o_conv = InvoiceFeatures_clone(&o_conv);
9621 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9622 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
9623 return (uint64_t)ret_conv;
9626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9627 LDKDecodeError e_conv;
9628 e_conv.inner = (void*)(e & (~1));
9629 e_conv.is_owned = (e & 1) || (e == 0);
9630 e_conv = DecodeError_clone(&e_conv);
9631 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9632 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
9633 return (uint64_t)ret_conv;
9636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9637 if ((_res & 1) != 0) return;
9638 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9640 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
9643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9644 LDKDelayedPaymentOutputDescriptor o_conv;
9645 o_conv.inner = (void*)(o & (~1));
9646 o_conv.is_owned = (o & 1) || (o == 0);
9647 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
9648 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9649 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9650 return (uint64_t)ret_conv;
9653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9654 LDKDecodeError e_conv;
9655 e_conv.inner = (void*)(e & (~1));
9656 e_conv.is_owned = (e & 1) || (e == 0);
9657 e_conv = DecodeError_clone(&e_conv);
9658 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9659 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9660 return (uint64_t)ret_conv;
9663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9664 if ((_res & 1) != 0) return;
9665 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9667 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9671 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9672 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9673 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9674 return (uint64_t)ret_conv;
9677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9678 LDKStaticPaymentOutputDescriptor o_conv;
9679 o_conv.inner = (void*)(o & (~1));
9680 o_conv.is_owned = (o & 1) || (o == 0);
9681 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
9682 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9683 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9684 return (uint64_t)ret_conv;
9687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9688 LDKDecodeError e_conv;
9689 e_conv.inner = (void*)(e & (~1));
9690 e_conv.is_owned = (e & 1) || (e == 0);
9691 e_conv = DecodeError_clone(&e_conv);
9692 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9693 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9694 return (uint64_t)ret_conv;
9697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9698 if ((_res & 1) != 0) return;
9699 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9701 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9705 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9706 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9707 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9708 return (uint64_t)ret_conv;
9711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9712 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
9713 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9714 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
9715 return (uint64_t)ret_conv;
9718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9719 LDKDecodeError e_conv;
9720 e_conv.inner = (void*)(e & (~1));
9721 e_conv.is_owned = (e & 1) || (e == 0);
9722 e_conv = DecodeError_clone(&e_conv);
9723 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9724 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
9725 return (uint64_t)ret_conv;
9728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9729 if ((_res & 1) != 0) return;
9730 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9732 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
9735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9736 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
9737 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9738 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
9739 return (uint64_t)ret_conv;
9742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9743 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
9744 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
9745 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
9746 return (uint64_t)ret_ref;
9749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
9751 CHECK((*env)->GetArrayLength(env, a) == 64);
9752 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
9753 LDKCVec_SignatureZ b_constr;
9754 b_constr.datalen = (*env)->GetArrayLength(env, b);
9755 if (b_constr.datalen > 0)
9756 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9758 b_constr.data = NULL;
9759 for (size_t i = 0; i < b_constr.datalen; i++) {
9760 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
9761 LDKSignature b_conv_8_ref;
9762 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
9763 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
9764 b_constr.data[i] = b_conv_8_ref;
9766 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
9767 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
9768 return (uint64_t)ret_ref;
9771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9772 if ((_res & 1) != 0) return;
9773 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
9775 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
9778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9779 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
9780 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9781 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
9782 return (uint64_t)ret_conv;
9785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
9786 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9787 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
9788 return (uint64_t)ret_conv;
9791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9792 if ((_res & 1) != 0) return;
9793 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
9795 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
9798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9799 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
9800 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9801 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
9802 return (uint64_t)ret_conv;
9805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9807 CHECK((*env)->GetArrayLength(env, o) == 64);
9808 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
9809 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9810 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
9811 return (uint64_t)ret_conv;
9814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
9815 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9816 *ret_conv = CResult_SignatureNoneZ_err();
9817 return (uint64_t)ret_conv;
9820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9821 if ((_res & 1) != 0) return;
9822 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
9824 CResult_SignatureNoneZ_free(_res_conv);
9827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9828 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
9829 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9830 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
9831 return (uint64_t)ret_conv;
9834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9835 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
9836 if (o_conv.free == LDKSign_JCalls_free) {
9837 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9838 LDKSign_JCalls_clone(o_conv.this_arg);
9840 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9841 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
9842 return (uint64_t)ret_conv;
9845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9846 LDKDecodeError e_conv;
9847 e_conv.inner = (void*)(e & (~1));
9848 e_conv.is_owned = (e & 1) || (e == 0);
9849 e_conv = DecodeError_clone(&e_conv);
9850 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9851 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
9852 return (uint64_t)ret_conv;
9855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9856 if ((_res & 1) != 0) return;
9857 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
9859 CResult_SignDecodeErrorZ_free(_res_conv);
9862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9863 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
9864 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9865 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
9866 return (uint64_t)ret_conv;
9869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
9870 LDKCVec_u8Z _res_ref;
9871 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
9872 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
9873 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
9874 CVec_u8Z_free(_res_ref);
9877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
9878 LDKRecoverableSignature arg_ref;
9879 CHECK((*env)->GetArrayLength(env, arg) == 68);
9880 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
9881 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9882 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
9883 return (uint64_t)ret_conv;
9886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
9887 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9888 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
9889 return (uint64_t)ret_conv;
9892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9893 if ((_res & 1) != 0) return;
9894 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
9896 CResult_RecoverableSignatureNoneZ_free(_res_conv);
9899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9900 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
9901 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9902 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
9903 return (uint64_t)ret_conv;
9906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9907 LDKCVec_CVec_u8ZZ _res_constr;
9908 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9909 if (_res_constr.datalen > 0)
9910 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9912 _res_constr.data = NULL;
9913 for (size_t i = 0; i < _res_constr.datalen; i++) {
9914 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9915 LDKCVec_u8Z _res_conv_8_ref;
9916 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
9917 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
9918 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
9919 _res_constr.data[i] = _res_conv_8_ref;
9921 CVec_CVec_u8ZZ_free(_res_constr);
9924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9925 LDKCVec_CVec_u8ZZ o_constr;
9926 o_constr.datalen = (*env)->GetArrayLength(env, o);
9927 if (o_constr.datalen > 0)
9928 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9930 o_constr.data = NULL;
9931 for (size_t i = 0; i < o_constr.datalen; i++) {
9932 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9933 LDKCVec_u8Z o_conv_8_ref;
9934 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
9935 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
9936 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
9937 o_constr.data[i] = o_conv_8_ref;
9939 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9940 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
9941 return (uint64_t)ret_conv;
9944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
9945 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9946 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
9947 return (uint64_t)ret_conv;
9950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9951 if ((_res & 1) != 0) return;
9952 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
9954 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
9957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9958 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
9959 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9960 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
9961 return (uint64_t)ret_conv;
9964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9965 LDKInMemorySigner o_conv;
9966 o_conv.inner = (void*)(o & (~1));
9967 o_conv.is_owned = (o & 1) || (o == 0);
9968 o_conv = InMemorySigner_clone(&o_conv);
9969 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9970 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
9971 return (uint64_t)ret_conv;
9974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9975 LDKDecodeError e_conv;
9976 e_conv.inner = (void*)(e & (~1));
9977 e_conv.is_owned = (e & 1) || (e == 0);
9978 e_conv = DecodeError_clone(&e_conv);
9979 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9980 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
9981 return (uint64_t)ret_conv;
9984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9985 if ((_res & 1) != 0) return;
9986 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
9988 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
9991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9992 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
9993 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9994 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
9995 return (uint64_t)ret_conv;
9998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9999 LDKCVec_TxOutZ _res_constr;
10000 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10001 if (_res_constr.datalen > 0)
10002 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10004 _res_constr.data = NULL;
10005 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10006 for (size_t h = 0; h < _res_constr.datalen; h++) {
10007 int64_t _res_conv_7 = _res_vals[h];
10008 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
10009 FREE((void*)_res_conv_7);
10010 _res_constr.data[h] = _res_conv_7_conv;
10012 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10013 CVec_TxOutZ_free(_res_constr);
10016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10017 LDKTransaction o_ref;
10018 o_ref.datalen = (*env)->GetArrayLength(env, o);
10019 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10020 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
10021 o_ref.data_is_owned = true;
10022 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10023 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10024 return (uint64_t)ret_conv;
10027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10028 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10029 *ret_conv = CResult_TransactionNoneZ_err();
10030 return (uint64_t)ret_conv;
10033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10034 if ((_res & 1) != 0) return;
10035 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
10037 CResult_TransactionNoneZ_free(_res_conv);
10040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10041 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10042 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10043 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10044 return (uint64_t)ret_conv;
10047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10048 LDKThirtyTwoBytes a_ref;
10049 CHECK((*env)->GetArrayLength(env, a) == 32);
10050 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10051 LDKChannelMonitor b_conv;
10052 b_conv.inner = (void*)(b & (~1));
10053 b_conv.is_owned = (b & 1) || (b == 0);
10054 b_conv = ChannelMonitor_clone(&b_conv);
10055 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10056 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10057 return (uint64_t)ret_ref;
10060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10061 if ((_res & 1) != 0) return;
10062 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
10064 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10068 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10069 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10070 if (_res_constr.datalen > 0)
10071 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10073 _res_constr.data = NULL;
10074 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10075 for (size_t i = 0; i < _res_constr.datalen; i++) {
10076 int64_t _res_conv_34 = _res_vals[i];
10077 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
10078 FREE((void*)_res_conv_34);
10079 _res_constr.data[i] = _res_conv_34_conv;
10081 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10082 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
10086 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10087 o_constr.datalen = (*env)->GetArrayLength(env, o);
10088 if (o_constr.datalen > 0)
10089 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10091 o_constr.data = NULL;
10092 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
10093 for (size_t i = 0; i < o_constr.datalen; i++) {
10094 int64_t o_conv_34 = o_vals[i];
10095 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
10096 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
10097 o_constr.data[i] = o_conv_34_conv;
10099 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
10100 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10101 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10102 return (uint64_t)ret_conv;
10105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10106 LDKIOError e_conv = LDKIOError_from_java(env, e);
10107 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10108 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10109 return (uint64_t)ret_conv;
10112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10113 if ((_res & 1) != 0) return;
10114 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
10116 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
10120 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10121 *ret_conv = CResult_NoneAPIErrorZ_ok();
10122 return (uint64_t)ret_conv;
10125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10126 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10127 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10128 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10129 return (uint64_t)ret_conv;
10132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10133 if ((_res & 1) != 0) return;
10134 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
10136 CResult_NoneAPIErrorZ_free(_res_conv);
10139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10140 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10141 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10142 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10143 return (uint64_t)ret_conv;
10146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10147 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
10148 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10149 if (_res_constr.datalen > 0)
10150 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
10152 _res_constr.data = NULL;
10153 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10154 for (size_t w = 0; w < _res_constr.datalen; w++) {
10155 int64_t _res_conv_22 = _res_vals[w];
10156 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
10157 FREE((void*)_res_conv_22);
10158 _res_constr.data[w] = _res_conv_22_conv;
10160 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10161 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
10164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10165 LDKCVec_APIErrorZ _res_constr;
10166 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10167 if (_res_constr.datalen > 0)
10168 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
10170 _res_constr.data = NULL;
10171 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10172 for (size_t k = 0; k < _res_constr.datalen; k++) {
10173 int64_t _res_conv_10 = _res_vals[k];
10174 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
10175 FREE((void*)_res_conv_10);
10176 _res_constr.data[k] = _res_conv_10_conv;
10178 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10179 CVec_APIErrorZ_free(_res_constr);
10182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
10183 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10184 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
10185 return (uint64_t)ret_conv;
10188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10189 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10190 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10191 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
10192 return (uint64_t)ret_conv;
10195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10196 if ((_res & 1) != 0) return;
10197 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10199 CResult_NonePaymentSendFailureZ_free(_res_conv);
10202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10203 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
10204 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10205 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
10206 return (uint64_t)ret_conv;
10209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10210 LDKCVec_NetAddressZ _res_constr;
10211 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10212 if (_res_constr.datalen > 0)
10213 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10215 _res_constr.data = NULL;
10216 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10217 for (size_t m = 0; m < _res_constr.datalen; m++) {
10218 int64_t _res_conv_12 = _res_vals[m];
10219 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
10220 FREE((void*)_res_conv_12);
10221 _res_constr.data[m] = _res_conv_12_conv;
10223 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10224 CVec_NetAddressZ_free(_res_constr);
10227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10228 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
10229 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10230 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
10231 return (uint64_t)ret_ref;
10234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
10235 LDKThirtyTwoBytes a_ref;
10236 CHECK((*env)->GetArrayLength(env, a) == 32);
10237 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10238 LDKThirtyTwoBytes b_ref;
10239 CHECK((*env)->GetArrayLength(env, b) == 32);
10240 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10241 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10242 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
10243 return (uint64_t)ret_ref;
10246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10247 if ((_res & 1) != 0) return;
10248 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
10250 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
10253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10254 LDKThirtyTwoBytes o_ref;
10255 CHECK((*env)->GetArrayLength(env, o) == 32);
10256 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10257 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10258 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
10259 return (uint64_t)ret_conv;
10262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10263 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10264 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10265 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
10266 return (uint64_t)ret_conv;
10269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10270 if ((_res & 1) != 0) return;
10271 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
10273 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
10276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10277 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
10278 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10279 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
10280 return (uint64_t)ret_conv;
10283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10284 LDKCVec_ChannelMonitorZ _res_constr;
10285 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10286 if (_res_constr.datalen > 0)
10287 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10289 _res_constr.data = NULL;
10290 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10291 for (size_t q = 0; q < _res_constr.datalen; q++) {
10292 int64_t _res_conv_16 = _res_vals[q];
10293 LDKChannelMonitor _res_conv_16_conv;
10294 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10295 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10296 _res_constr.data[q] = _res_conv_16_conv;
10298 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10299 CVec_ChannelMonitorZ_free(_res_constr);
10302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10303 LDKThirtyTwoBytes a_ref;
10304 CHECK((*env)->GetArrayLength(env, a) == 32);
10305 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10306 LDKChannelManager b_conv;
10307 b_conv.inner = (void*)(b & (~1));
10308 b_conv.is_owned = (b & 1) || (b == 0);
10309 // Warning: we need a move here but no clone is available for LDKChannelManager
10310 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
10311 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
10312 return (uint64_t)ret_ref;
10315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10316 if ((_res & 1) != 0) return;
10317 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
10319 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
10322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10323 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
10324 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10325 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
10326 return (uint64_t)ret_conv;
10329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10330 LDKDecodeError e_conv;
10331 e_conv.inner = (void*)(e & (~1));
10332 e_conv.is_owned = (e & 1) || (e == 0);
10333 e_conv = DecodeError_clone(&e_conv);
10334 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10335 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
10336 return (uint64_t)ret_conv;
10339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10340 if ((_res & 1) != 0) return;
10341 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10343 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
10346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10347 LDKChannelConfig o_conv;
10348 o_conv.inner = (void*)(o & (~1));
10349 o_conv.is_owned = (o & 1) || (o == 0);
10350 o_conv = ChannelConfig_clone(&o_conv);
10351 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10352 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
10353 return (uint64_t)ret_conv;
10356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10357 LDKDecodeError e_conv;
10358 e_conv.inner = (void*)(e & (~1));
10359 e_conv.is_owned = (e & 1) || (e == 0);
10360 e_conv = DecodeError_clone(&e_conv);
10361 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10362 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
10363 return (uint64_t)ret_conv;
10366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10367 if ((_res & 1) != 0) return;
10368 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
10370 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
10373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10374 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
10375 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10376 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
10377 return (uint64_t)ret_conv;
10380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10381 LDKOutPoint o_conv;
10382 o_conv.inner = (void*)(o & (~1));
10383 o_conv.is_owned = (o & 1) || (o == 0);
10384 o_conv = OutPoint_clone(&o_conv);
10385 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10386 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
10387 return (uint64_t)ret_conv;
10390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10391 LDKDecodeError e_conv;
10392 e_conv.inner = (void*)(e & (~1));
10393 e_conv.is_owned = (e & 1) || (e == 0);
10394 e_conv = DecodeError_clone(&e_conv);
10395 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10396 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
10397 return (uint64_t)ret_conv;
10400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10401 if ((_res & 1) != 0) return;
10402 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
10404 CResult_OutPointDecodeErrorZ_free(_res_conv);
10407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10408 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
10409 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10410 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
10411 return (uint64_t)ret_conv;
10414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
10415 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
10416 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10417 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
10418 return (uint64_t)ret_conv;
10421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
10422 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10423 *ret_conv = CResult_SiPrefixNoneZ_err();
10424 return (uint64_t)ret_conv;
10427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10428 if ((_res & 1) != 0) return;
10429 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
10431 CResult_SiPrefixNoneZ_free(_res_conv);
10434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10435 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
10436 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10437 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
10438 return (uint64_t)ret_conv;
10441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10443 o_conv.inner = (void*)(o & (~1));
10444 o_conv.is_owned = (o & 1) || (o == 0);
10445 o_conv = Invoice_clone(&o_conv);
10446 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10447 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
10448 return (uint64_t)ret_conv;
10451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10452 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10453 *ret_conv = CResult_InvoiceNoneZ_err();
10454 return (uint64_t)ret_conv;
10457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10458 if ((_res & 1) != 0) return;
10459 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
10461 CResult_InvoiceNoneZ_free(_res_conv);
10464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10465 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
10466 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10467 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
10468 return (uint64_t)ret_conv;
10471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10472 LDKSignedRawInvoice o_conv;
10473 o_conv.inner = (void*)(o & (~1));
10474 o_conv.is_owned = (o & 1) || (o == 0);
10475 o_conv = SignedRawInvoice_clone(&o_conv);
10476 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10477 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
10478 return (uint64_t)ret_conv;
10481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10482 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10483 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
10484 return (uint64_t)ret_conv;
10487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10488 if ((_res & 1) != 0) return;
10489 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
10491 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
10494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10495 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
10496 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10497 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
10498 return (uint64_t)ret_conv;
10501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10502 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
10503 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10504 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
10505 return (uint64_t)ret_ref;
10508 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) {
10509 LDKRawInvoice a_conv;
10510 a_conv.inner = (void*)(a & (~1));
10511 a_conv.is_owned = (a & 1) || (a == 0);
10512 a_conv = RawInvoice_clone(&a_conv);
10513 LDKThirtyTwoBytes b_ref;
10514 CHECK((*env)->GetArrayLength(env, b) == 32);
10515 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10516 LDKInvoiceSignature c_conv;
10517 c_conv.inner = (void*)(c & (~1));
10518 c_conv.is_owned = (c & 1) || (c == 0);
10519 c_conv = InvoiceSignature_clone(&c_conv);
10520 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10521 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
10522 return (uint64_t)ret_ref;
10525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10526 if ((_res & 1) != 0) return;
10527 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
10529 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
10532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10533 LDKPayeePubKey o_conv;
10534 o_conv.inner = (void*)(o & (~1));
10535 o_conv.is_owned = (o & 1) || (o == 0);
10536 o_conv = PayeePubKey_clone(&o_conv);
10537 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10538 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
10539 return (uint64_t)ret_conv;
10542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10543 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10544 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10545 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
10546 return (uint64_t)ret_conv;
10549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10550 if ((_res & 1) != 0) return;
10551 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
10553 CResult_PayeePubKeyErrorZ_free(_res_conv);
10556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10557 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
10558 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10559 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
10560 return (uint64_t)ret_conv;
10563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10564 LDKCVec_RouteHintZ _res_constr;
10565 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10566 if (_res_constr.datalen > 0)
10567 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
10569 _res_constr.data = NULL;
10570 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10571 for (size_t l = 0; l < _res_constr.datalen; l++) {
10572 int64_t _res_conv_11 = _res_vals[l];
10573 LDKRouteHint _res_conv_11_conv;
10574 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
10575 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
10576 _res_constr.data[l] = _res_conv_11_conv;
10578 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10579 CVec_RouteHintZ_free(_res_constr);
10582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10583 LDKPositiveTimestamp o_conv;
10584 o_conv.inner = (void*)(o & (~1));
10585 o_conv.is_owned = (o & 1) || (o == 0);
10586 o_conv = PositiveTimestamp_clone(&o_conv);
10587 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10588 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
10589 return (uint64_t)ret_conv;
10592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10593 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10594 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10595 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
10596 return (uint64_t)ret_conv;
10599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10600 if ((_res & 1) != 0) return;
10601 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
10603 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
10606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10607 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
10608 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10609 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
10610 return (uint64_t)ret_conv;
10613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
10614 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10615 *ret_conv = CResult_NoneSemanticErrorZ_ok();
10616 return (uint64_t)ret_conv;
10619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10620 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10621 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10622 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
10623 return (uint64_t)ret_conv;
10626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10627 if ((_res & 1) != 0) return;
10628 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
10630 CResult_NoneSemanticErrorZ_free(_res_conv);
10633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10634 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
10635 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10636 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
10637 return (uint64_t)ret_conv;
10640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10642 o_conv.inner = (void*)(o & (~1));
10643 o_conv.is_owned = (o & 1) || (o == 0);
10644 o_conv = Invoice_clone(&o_conv);
10645 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10646 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
10647 return (uint64_t)ret_conv;
10650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10651 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10652 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10653 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
10654 return (uint64_t)ret_conv;
10657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10658 if ((_res & 1) != 0) return;
10659 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
10661 CResult_InvoiceSemanticErrorZ_free(_res_conv);
10664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10665 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
10666 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10667 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
10668 return (uint64_t)ret_conv;
10671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10672 LDKDescription o_conv;
10673 o_conv.inner = (void*)(o & (~1));
10674 o_conv.is_owned = (o & 1) || (o == 0);
10675 o_conv = Description_clone(&o_conv);
10676 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10677 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
10678 return (uint64_t)ret_conv;
10681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10682 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10683 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10684 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
10685 return (uint64_t)ret_conv;
10688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10689 if ((_res & 1) != 0) return;
10690 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
10692 CResult_DescriptionCreationErrorZ_free(_res_conv);
10695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10696 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
10697 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10698 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
10699 return (uint64_t)ret_conv;
10702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10703 LDKExpiryTime o_conv;
10704 o_conv.inner = (void*)(o & (~1));
10705 o_conv.is_owned = (o & 1) || (o == 0);
10706 o_conv = ExpiryTime_clone(&o_conv);
10707 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10708 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
10709 return (uint64_t)ret_conv;
10712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10713 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10714 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10715 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
10716 return (uint64_t)ret_conv;
10719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10720 if ((_res & 1) != 0) return;
10721 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
10723 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
10726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10727 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
10728 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10729 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
10730 return (uint64_t)ret_conv;
10733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10734 LDKRouteHint o_conv;
10735 o_conv.inner = (void*)(o & (~1));
10736 o_conv.is_owned = (o & 1) || (o == 0);
10737 o_conv = RouteHint_clone(&o_conv);
10738 LDKCResult_RouteHintCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintCreationErrorZ), "LDKCResult_RouteHintCreationErrorZ");
10739 *ret_conv = CResult_RouteHintCreationErrorZ_ok(o_conv);
10740 return (uint64_t)ret_conv;
10743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10744 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10745 LDKCResult_RouteHintCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintCreationErrorZ), "LDKCResult_RouteHintCreationErrorZ");
10746 *ret_conv = CResult_RouteHintCreationErrorZ_err(e_conv);
10747 return (uint64_t)ret_conv;
10750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10751 if ((_res & 1) != 0) return;
10752 LDKCResult_RouteHintCreationErrorZ _res_conv = *(LDKCResult_RouteHintCreationErrorZ*)(((uint64_t)_res) & ~1);
10754 CResult_RouteHintCreationErrorZ_free(_res_conv);
10757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10758 LDKCResult_RouteHintCreationErrorZ* orig_conv = (LDKCResult_RouteHintCreationErrorZ*)(orig & ~1);
10759 LDKCResult_RouteHintCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintCreationErrorZ), "LDKCResult_RouteHintCreationErrorZ");
10760 *ret_conv = CResult_RouteHintCreationErrorZ_clone(orig_conv);
10761 return (uint64_t)ret_conv;
10764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
10765 LDKStr o_conv = java_to_owned_str(env, o);
10766 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10767 *ret_conv = CResult_StringErrorZ_ok(o_conv);
10768 return (uint64_t)ret_conv;
10771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10772 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10773 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10774 *ret_conv = CResult_StringErrorZ_err(e_conv);
10775 return (uint64_t)ret_conv;
10778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10779 if ((_res & 1) != 0) return;
10780 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
10782 CResult_StringErrorZ_free(_res_conv);
10785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10786 LDKChannelMonitorUpdate o_conv;
10787 o_conv.inner = (void*)(o & (~1));
10788 o_conv.is_owned = (o & 1) || (o == 0);
10789 o_conv = ChannelMonitorUpdate_clone(&o_conv);
10790 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10791 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
10792 return (uint64_t)ret_conv;
10795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10796 LDKDecodeError e_conv;
10797 e_conv.inner = (void*)(e & (~1));
10798 e_conv.is_owned = (e & 1) || (e == 0);
10799 e_conv = DecodeError_clone(&e_conv);
10800 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10801 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
10802 return (uint64_t)ret_conv;
10805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10806 if ((_res & 1) != 0) return;
10807 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10809 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
10812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10813 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
10814 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10815 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
10816 return (uint64_t)ret_conv;
10819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10820 LDKHTLCUpdate o_conv;
10821 o_conv.inner = (void*)(o & (~1));
10822 o_conv.is_owned = (o & 1) || (o == 0);
10823 o_conv = HTLCUpdate_clone(&o_conv);
10824 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10825 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
10826 return (uint64_t)ret_conv;
10829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10830 LDKDecodeError e_conv;
10831 e_conv.inner = (void*)(e & (~1));
10832 e_conv.is_owned = (e & 1) || (e == 0);
10833 e_conv = DecodeError_clone(&e_conv);
10834 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10835 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
10836 return (uint64_t)ret_conv;
10839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10840 if ((_res & 1) != 0) return;
10841 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10843 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
10846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10847 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
10848 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10849 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
10850 return (uint64_t)ret_conv;
10853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
10854 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10855 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
10856 return (uint64_t)ret_conv;
10859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10860 LDKMonitorUpdateError e_conv;
10861 e_conv.inner = (void*)(e & (~1));
10862 e_conv.is_owned = (e & 1) || (e == 0);
10863 e_conv = MonitorUpdateError_clone(&e_conv);
10864 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10865 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
10866 return (uint64_t)ret_conv;
10869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10870 if ((_res & 1) != 0) return;
10871 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
10873 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
10876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10877 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
10878 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10879 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
10880 return (uint64_t)ret_conv;
10883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10884 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
10885 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10886 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
10887 return (uint64_t)ret_ref;
10890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
10891 LDKOutPoint a_conv;
10892 a_conv.inner = (void*)(a & (~1));
10893 a_conv.is_owned = (a & 1) || (a == 0);
10894 a_conv = OutPoint_clone(&a_conv);
10896 b_ref.datalen = (*env)->GetArrayLength(env, b);
10897 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10898 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10899 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10900 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10901 return (uint64_t)ret_ref;
10904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10905 if ((_res & 1) != 0) return;
10906 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
10908 C2Tuple_OutPointScriptZ_free(_res_conv);
10911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10912 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
10913 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10914 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
10915 return (uint64_t)ret_ref;
10918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
10920 b_ref.datalen = (*env)->GetArrayLength(env, b);
10921 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10922 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10923 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10924 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
10925 return (uint64_t)ret_ref;
10928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10929 if ((_res & 1) != 0) return;
10930 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
10932 C2Tuple_u32ScriptZ_free(_res_conv);
10935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10936 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10937 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10938 if (_res_constr.datalen > 0)
10939 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10941 _res_constr.data = NULL;
10942 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10943 for (size_t b = 0; b < _res_constr.datalen; b++) {
10944 int64_t _res_conv_27 = _res_vals[b];
10945 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
10946 FREE((void*)_res_conv_27);
10947 _res_constr.data[b] = _res_conv_27_conv;
10949 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10950 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10954 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
10955 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10956 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
10957 return (uint64_t)ret_ref;
10960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
10961 LDKThirtyTwoBytes a_ref;
10962 CHECK((*env)->GetArrayLength(env, a) == 32);
10963 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10964 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10965 b_constr.datalen = (*env)->GetArrayLength(env, b);
10966 if (b_constr.datalen > 0)
10967 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10969 b_constr.data = NULL;
10970 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
10971 for (size_t b = 0; b < b_constr.datalen; b++) {
10972 int64_t b_conv_27 = b_vals[b];
10973 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
10974 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
10975 b_constr.data[b] = b_conv_27_conv;
10977 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
10978 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10979 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10980 return (uint64_t)ret_ref;
10983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10984 if ((_res & 1) != 0) return;
10985 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
10987 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10991 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10992 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10993 if (_res_constr.datalen > 0)
10994 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
10996 _res_constr.data = NULL;
10997 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10998 for (size_t v = 0; v < _res_constr.datalen; v++) {
10999 int64_t _res_conv_47 = _res_vals[v];
11000 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
11001 FREE((void*)_res_conv_47);
11002 _res_constr.data[v] = _res_conv_47_conv;
11004 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11005 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
11008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11009 LDKCVec_EventZ _res_constr;
11010 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11011 if (_res_constr.datalen > 0)
11012 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
11014 _res_constr.data = NULL;
11015 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11016 for (size_t h = 0; h < _res_constr.datalen; h++) {
11017 int64_t _res_conv_7 = _res_vals[h];
11018 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
11019 FREE((void*)_res_conv_7);
11020 _res_constr.data[h] = _res_conv_7_conv;
11022 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11023 CVec_EventZ_free(_res_constr);
11026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11027 LDKCVec_TransactionZ _res_constr;
11028 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11029 if (_res_constr.datalen > 0)
11030 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
11032 _res_constr.data = NULL;
11033 for (size_t i = 0; i < _res_constr.datalen; i++) {
11034 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11035 LDKTransaction _res_conv_8_ref;
11036 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11037 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
11038 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11039 _res_conv_8_ref.data_is_owned = true;
11040 _res_constr.data[i] = _res_conv_8_ref;
11042 CVec_TransactionZ_free(_res_constr);
11045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11046 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
11047 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11048 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
11049 return (uint64_t)ret_ref;
11052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
11053 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
11054 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11055 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
11056 return (uint64_t)ret_ref;
11059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11060 if ((_res & 1) != 0) return;
11061 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
11063 C2Tuple_u32TxOutZ_free(_res_conv);
11066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11067 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
11068 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11069 if (_res_constr.datalen > 0)
11070 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11072 _res_constr.data = NULL;
11073 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11074 for (size_t a = 0; a < _res_constr.datalen; a++) {
11075 int64_t _res_conv_26 = _res_vals[a];
11076 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
11077 FREE((void*)_res_conv_26);
11078 _res_constr.data[a] = _res_conv_26_conv;
11080 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11081 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
11084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11085 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
11086 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11087 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
11088 return (uint64_t)ret_ref;
11091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11092 LDKThirtyTwoBytes a_ref;
11093 CHECK((*env)->GetArrayLength(env, a) == 32);
11094 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11095 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
11096 b_constr.datalen = (*env)->GetArrayLength(env, b);
11097 if (b_constr.datalen > 0)
11098 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11100 b_constr.data = NULL;
11101 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11102 for (size_t a = 0; a < b_constr.datalen; a++) {
11103 int64_t b_conv_26 = b_vals[a];
11104 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
11105 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
11106 b_constr.data[a] = b_conv_26_conv;
11108 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11109 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11110 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
11111 return (uint64_t)ret_ref;
11114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11115 if ((_res & 1) != 0) return;
11116 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
11118 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
11121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11122 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
11123 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11124 if (_res_constr.datalen > 0)
11125 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
11127 _res_constr.data = NULL;
11128 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11129 for (size_t u = 0; u < _res_constr.datalen; u++) {
11130 int64_t _res_conv_46 = _res_vals[u];
11131 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
11132 FREE((void*)_res_conv_46);
11133 _res_constr.data[u] = _res_conv_46_conv;
11135 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11136 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
11139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11140 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
11141 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11142 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
11143 return (uint64_t)ret_conv;
11146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11147 LDKDecodeError e_conv;
11148 e_conv.inner = (void*)(e & (~1));
11149 e_conv.is_owned = (e & 1) || (e == 0);
11150 e_conv = DecodeError_clone(&e_conv);
11151 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11152 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
11153 return (uint64_t)ret_conv;
11156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11157 if ((_res & 1) != 0) return;
11158 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11160 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
11163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11164 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11165 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11166 return (uint64_t)ret_conv;
11169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11170 LDKLightningError e_conv;
11171 e_conv.inner = (void*)(e & (~1));
11172 e_conv.is_owned = (e & 1) || (e == 0);
11173 e_conv = LightningError_clone(&e_conv);
11174 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11175 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11176 return (uint64_t)ret_conv;
11179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11180 if ((_res & 1) != 0) return;
11181 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
11183 CResult_boolLightningErrorZ_free(_res_conv);
11186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11187 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11188 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11189 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11190 return (uint64_t)ret_conv;
11193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11194 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11195 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11196 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11197 return (uint64_t)ret_ref;
11200 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) {
11201 LDKChannelAnnouncement a_conv;
11202 a_conv.inner = (void*)(a & (~1));
11203 a_conv.is_owned = (a & 1) || (a == 0);
11204 a_conv = ChannelAnnouncement_clone(&a_conv);
11205 LDKChannelUpdate b_conv;
11206 b_conv.inner = (void*)(b & (~1));
11207 b_conv.is_owned = (b & 1) || (b == 0);
11208 b_conv = ChannelUpdate_clone(&b_conv);
11209 LDKChannelUpdate c_conv;
11210 c_conv.inner = (void*)(c & (~1));
11211 c_conv.is_owned = (c & 1) || (c == 0);
11212 c_conv = ChannelUpdate_clone(&c_conv);
11213 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11214 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11215 return (uint64_t)ret_ref;
11218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11219 if ((_res & 1) != 0) return;
11220 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
11222 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11226 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11227 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11228 if (_res_constr.datalen > 0)
11229 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11231 _res_constr.data = NULL;
11232 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11233 for (size_t l = 0; l < _res_constr.datalen; l++) {
11234 int64_t _res_conv_63 = _res_vals[l];
11235 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
11236 FREE((void*)_res_conv_63);
11237 _res_constr.data[l] = _res_conv_63_conv;
11239 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11240 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11244 LDKCVec_NodeAnnouncementZ _res_constr;
11245 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11246 if (_res_constr.datalen > 0)
11247 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11249 _res_constr.data = NULL;
11250 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11251 for (size_t s = 0; s < _res_constr.datalen; s++) {
11252 int64_t _res_conv_18 = _res_vals[s];
11253 LDKNodeAnnouncement _res_conv_18_conv;
11254 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11255 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11256 _res_constr.data[s] = _res_conv_18_conv;
11258 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11259 CVec_NodeAnnouncementZ_free(_res_constr);
11262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
11263 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11264 *ret_conv = CResult_NoneLightningErrorZ_ok();
11265 return (uint64_t)ret_conv;
11268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11269 LDKLightningError e_conv;
11270 e_conv.inner = (void*)(e & (~1));
11271 e_conv.is_owned = (e & 1) || (e == 0);
11272 e_conv = LightningError_clone(&e_conv);
11273 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11274 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11275 return (uint64_t)ret_conv;
11278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11279 if ((_res & 1) != 0) return;
11280 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
11282 CResult_NoneLightningErrorZ_free(_res_conv);
11285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11286 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11287 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11288 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11289 return (uint64_t)ret_conv;
11292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11293 LDKCVec_PublicKeyZ _res_constr;
11294 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11295 if (_res_constr.datalen > 0)
11296 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11298 _res_constr.data = NULL;
11299 for (size_t i = 0; i < _res_constr.datalen; i++) {
11300 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11301 LDKPublicKey _res_conv_8_ref;
11302 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
11303 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
11304 _res_constr.data[i] = _res_conv_8_ref;
11306 CVec_PublicKeyZ_free(_res_constr);
11309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11311 o_ref.datalen = (*env)->GetArrayLength(env, o);
11312 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11313 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11314 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11315 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11316 return (uint64_t)ret_conv;
11319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11320 LDKPeerHandleError e_conv;
11321 e_conv.inner = (void*)(e & (~1));
11322 e_conv.is_owned = (e & 1) || (e == 0);
11323 e_conv = PeerHandleError_clone(&e_conv);
11324 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11325 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11326 return (uint64_t)ret_conv;
11329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11330 if ((_res & 1) != 0) return;
11331 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11333 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11337 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11338 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11339 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11340 return (uint64_t)ret_conv;
11343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
11344 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11345 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11346 return (uint64_t)ret_conv;
11349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11350 LDKPeerHandleError e_conv;
11351 e_conv.inner = (void*)(e & (~1));
11352 e_conv.is_owned = (e & 1) || (e == 0);
11353 e_conv = PeerHandleError_clone(&e_conv);
11354 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11355 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11356 return (uint64_t)ret_conv;
11359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11360 if ((_res & 1) != 0) return;
11361 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11363 CResult_NonePeerHandleErrorZ_free(_res_conv);
11366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11367 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11368 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11369 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11370 return (uint64_t)ret_conv;
11373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11374 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11375 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11376 return (uint64_t)ret_conv;
11379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11380 LDKPeerHandleError e_conv;
11381 e_conv.inner = (void*)(e & (~1));
11382 e_conv.is_owned = (e & 1) || (e == 0);
11383 e_conv = PeerHandleError_clone(&e_conv);
11384 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11385 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11386 return (uint64_t)ret_conv;
11389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11390 if ((_res & 1) != 0) return;
11391 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11393 CResult_boolPeerHandleErrorZ_free(_res_conv);
11396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11397 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11398 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11399 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11400 return (uint64_t)ret_conv;
11403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11404 LDKDirectionalChannelInfo o_conv;
11405 o_conv.inner = (void*)(o & (~1));
11406 o_conv.is_owned = (o & 1) || (o == 0);
11407 o_conv = DirectionalChannelInfo_clone(&o_conv);
11408 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11409 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
11410 return (uint64_t)ret_conv;
11413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11414 LDKDecodeError e_conv;
11415 e_conv.inner = (void*)(e & (~1));
11416 e_conv.is_owned = (e & 1) || (e == 0);
11417 e_conv = DecodeError_clone(&e_conv);
11418 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11419 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
11420 return (uint64_t)ret_conv;
11423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11424 if ((_res & 1) != 0) return;
11425 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11427 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
11430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11431 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
11432 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11433 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
11434 return (uint64_t)ret_conv;
11437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11438 LDKChannelInfo o_conv;
11439 o_conv.inner = (void*)(o & (~1));
11440 o_conv.is_owned = (o & 1) || (o == 0);
11441 o_conv = ChannelInfo_clone(&o_conv);
11442 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11443 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
11444 return (uint64_t)ret_conv;
11447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11448 LDKDecodeError e_conv;
11449 e_conv.inner = (void*)(e & (~1));
11450 e_conv.is_owned = (e & 1) || (e == 0);
11451 e_conv = DecodeError_clone(&e_conv);
11452 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11453 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
11454 return (uint64_t)ret_conv;
11457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11458 if ((_res & 1) != 0) return;
11459 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11461 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
11464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11465 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
11466 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11467 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
11468 return (uint64_t)ret_conv;
11471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11472 LDKRoutingFees o_conv;
11473 o_conv.inner = (void*)(o & (~1));
11474 o_conv.is_owned = (o & 1) || (o == 0);
11475 o_conv = RoutingFees_clone(&o_conv);
11476 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11477 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
11478 return (uint64_t)ret_conv;
11481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11482 LDKDecodeError e_conv;
11483 e_conv.inner = (void*)(e & (~1));
11484 e_conv.is_owned = (e & 1) || (e == 0);
11485 e_conv = DecodeError_clone(&e_conv);
11486 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11487 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
11488 return (uint64_t)ret_conv;
11491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11492 if ((_res & 1) != 0) return;
11493 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11495 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
11498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11499 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
11500 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11501 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
11502 return (uint64_t)ret_conv;
11505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11506 LDKNodeAnnouncementInfo o_conv;
11507 o_conv.inner = (void*)(o & (~1));
11508 o_conv.is_owned = (o & 1) || (o == 0);
11509 o_conv = NodeAnnouncementInfo_clone(&o_conv);
11510 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11511 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
11512 return (uint64_t)ret_conv;
11515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11516 LDKDecodeError e_conv;
11517 e_conv.inner = (void*)(e & (~1));
11518 e_conv.is_owned = (e & 1) || (e == 0);
11519 e_conv = DecodeError_clone(&e_conv);
11520 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11521 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
11522 return (uint64_t)ret_conv;
11525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11526 if ((_res & 1) != 0) return;
11527 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11529 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
11532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11533 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
11534 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11535 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
11536 return (uint64_t)ret_conv;
11539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11540 LDKCVec_u64Z _res_constr;
11541 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11542 if (_res_constr.datalen > 0)
11543 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11545 _res_constr.data = NULL;
11546 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11547 for (size_t g = 0; g < _res_constr.datalen; g++) {
11548 int64_t _res_conv_6 = _res_vals[g];
11549 _res_constr.data[g] = _res_conv_6;
11551 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11552 CVec_u64Z_free(_res_constr);
11555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11556 LDKNodeInfo o_conv;
11557 o_conv.inner = (void*)(o & (~1));
11558 o_conv.is_owned = (o & 1) || (o == 0);
11559 o_conv = NodeInfo_clone(&o_conv);
11560 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11561 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
11562 return (uint64_t)ret_conv;
11565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11566 LDKDecodeError e_conv;
11567 e_conv.inner = (void*)(e & (~1));
11568 e_conv.is_owned = (e & 1) || (e == 0);
11569 e_conv = DecodeError_clone(&e_conv);
11570 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11571 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
11572 return (uint64_t)ret_conv;
11575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11576 if ((_res & 1) != 0) return;
11577 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11579 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
11582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11583 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
11584 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11585 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
11586 return (uint64_t)ret_conv;
11589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11590 LDKNetworkGraph o_conv;
11591 o_conv.inner = (void*)(o & (~1));
11592 o_conv.is_owned = (o & 1) || (o == 0);
11593 o_conv = NetworkGraph_clone(&o_conv);
11594 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11595 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
11596 return (uint64_t)ret_conv;
11599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11600 LDKDecodeError e_conv;
11601 e_conv.inner = (void*)(e & (~1));
11602 e_conv.is_owned = (e & 1) || (e == 0);
11603 e_conv = DecodeError_clone(&e_conv);
11604 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11605 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
11606 return (uint64_t)ret_conv;
11609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11610 if ((_res & 1) != 0) return;
11611 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
11613 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
11616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11617 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
11618 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11619 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
11620 return (uint64_t)ret_conv;
11623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
11624 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11625 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11626 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
11627 return (uint64_t)ret_conv;
11630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
11631 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11632 *ret_conv = CResult_NetAddressu8Z_err(e);
11633 return (uint64_t)ret_conv;
11636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11637 if ((_res & 1) != 0) return;
11638 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
11640 CResult_NetAddressu8Z_free(_res_conv);
11643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11644 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
11645 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11646 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
11647 return (uint64_t)ret_conv;
11650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11651 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
11652 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11653 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
11654 return (uint64_t)ret_conv;
11657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11658 LDKDecodeError e_conv;
11659 e_conv.inner = (void*)(e & (~1));
11660 e_conv.is_owned = (e & 1) || (e == 0);
11661 e_conv = DecodeError_clone(&e_conv);
11662 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11663 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
11664 return (uint64_t)ret_conv;
11667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11668 if ((_res & 1) != 0) return;
11669 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11671 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
11674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11675 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
11676 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11677 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
11678 return (uint64_t)ret_conv;
11681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11682 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11683 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11684 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
11685 return (uint64_t)ret_conv;
11688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11689 LDKDecodeError e_conv;
11690 e_conv.inner = (void*)(e & (~1));
11691 e_conv.is_owned = (e & 1) || (e == 0);
11692 e_conv = DecodeError_clone(&e_conv);
11693 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11694 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
11695 return (uint64_t)ret_conv;
11698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11699 if ((_res & 1) != 0) return;
11700 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
11702 CResult_NetAddressDecodeErrorZ_free(_res_conv);
11705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11706 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
11707 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11708 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
11709 return (uint64_t)ret_conv;
11712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11713 LDKCVec_UpdateAddHTLCZ _res_constr;
11714 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11715 if (_res_constr.datalen > 0)
11716 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11718 _res_constr.data = NULL;
11719 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11720 for (size_t p = 0; p < _res_constr.datalen; p++) {
11721 int64_t _res_conv_15 = _res_vals[p];
11722 LDKUpdateAddHTLC _res_conv_15_conv;
11723 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
11724 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
11725 _res_constr.data[p] = _res_conv_15_conv;
11727 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11728 CVec_UpdateAddHTLCZ_free(_res_constr);
11731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11732 LDKCVec_UpdateFulfillHTLCZ _res_constr;
11733 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11734 if (_res_constr.datalen > 0)
11735 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11737 _res_constr.data = NULL;
11738 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11739 for (size_t t = 0; t < _res_constr.datalen; t++) {
11740 int64_t _res_conv_19 = _res_vals[t];
11741 LDKUpdateFulfillHTLC _res_conv_19_conv;
11742 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
11743 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
11744 _res_constr.data[t] = _res_conv_19_conv;
11746 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11747 CVec_UpdateFulfillHTLCZ_free(_res_constr);
11750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11751 LDKCVec_UpdateFailHTLCZ _res_constr;
11752 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11753 if (_res_constr.datalen > 0)
11754 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11756 _res_constr.data = NULL;
11757 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11758 for (size_t q = 0; q < _res_constr.datalen; q++) {
11759 int64_t _res_conv_16 = _res_vals[q];
11760 LDKUpdateFailHTLC _res_conv_16_conv;
11761 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11762 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11763 _res_constr.data[q] = _res_conv_16_conv;
11765 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11766 CVec_UpdateFailHTLCZ_free(_res_constr);
11769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11770 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
11771 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11772 if (_res_constr.datalen > 0)
11773 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11775 _res_constr.data = NULL;
11776 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11777 for (size_t z = 0; z < _res_constr.datalen; z++) {
11778 int64_t _res_conv_25 = _res_vals[z];
11779 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
11780 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
11781 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
11782 _res_constr.data[z] = _res_conv_25_conv;
11784 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11785 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
11788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11789 LDKAcceptChannel o_conv;
11790 o_conv.inner = (void*)(o & (~1));
11791 o_conv.is_owned = (o & 1) || (o == 0);
11792 o_conv = AcceptChannel_clone(&o_conv);
11793 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11794 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
11795 return (uint64_t)ret_conv;
11798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11799 LDKDecodeError e_conv;
11800 e_conv.inner = (void*)(e & (~1));
11801 e_conv.is_owned = (e & 1) || (e == 0);
11802 e_conv = DecodeError_clone(&e_conv);
11803 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11804 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
11805 return (uint64_t)ret_conv;
11808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11809 if ((_res & 1) != 0) return;
11810 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
11812 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
11815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11816 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
11817 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11818 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
11819 return (uint64_t)ret_conv;
11822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11823 LDKAnnouncementSignatures o_conv;
11824 o_conv.inner = (void*)(o & (~1));
11825 o_conv.is_owned = (o & 1) || (o == 0);
11826 o_conv = AnnouncementSignatures_clone(&o_conv);
11827 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11828 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
11829 return (uint64_t)ret_conv;
11832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11833 LDKDecodeError e_conv;
11834 e_conv.inner = (void*)(e & (~1));
11835 e_conv.is_owned = (e & 1) || (e == 0);
11836 e_conv = DecodeError_clone(&e_conv);
11837 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11838 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
11839 return (uint64_t)ret_conv;
11842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11843 if ((_res & 1) != 0) return;
11844 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11846 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
11849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11850 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
11851 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11852 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
11853 return (uint64_t)ret_conv;
11856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11857 LDKChannelReestablish o_conv;
11858 o_conv.inner = (void*)(o & (~1));
11859 o_conv.is_owned = (o & 1) || (o == 0);
11860 o_conv = ChannelReestablish_clone(&o_conv);
11861 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11862 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
11863 return (uint64_t)ret_conv;
11866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11867 LDKDecodeError e_conv;
11868 e_conv.inner = (void*)(e & (~1));
11869 e_conv.is_owned = (e & 1) || (e == 0);
11870 e_conv = DecodeError_clone(&e_conv);
11871 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11872 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
11873 return (uint64_t)ret_conv;
11876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11877 if ((_res & 1) != 0) return;
11878 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
11880 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
11883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11884 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
11885 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11886 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
11887 return (uint64_t)ret_conv;
11890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11891 LDKClosingSigned o_conv;
11892 o_conv.inner = (void*)(o & (~1));
11893 o_conv.is_owned = (o & 1) || (o == 0);
11894 o_conv = ClosingSigned_clone(&o_conv);
11895 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11896 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
11897 return (uint64_t)ret_conv;
11900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11901 LDKDecodeError e_conv;
11902 e_conv.inner = (void*)(e & (~1));
11903 e_conv.is_owned = (e & 1) || (e == 0);
11904 e_conv = DecodeError_clone(&e_conv);
11905 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11906 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
11907 return (uint64_t)ret_conv;
11910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11911 if ((_res & 1) != 0) return;
11912 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11914 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
11917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11918 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
11919 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11920 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
11921 return (uint64_t)ret_conv;
11924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11925 LDKCommitmentSigned o_conv;
11926 o_conv.inner = (void*)(o & (~1));
11927 o_conv.is_owned = (o & 1) || (o == 0);
11928 o_conv = CommitmentSigned_clone(&o_conv);
11929 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11930 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
11931 return (uint64_t)ret_conv;
11934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11935 LDKDecodeError e_conv;
11936 e_conv.inner = (void*)(e & (~1));
11937 e_conv.is_owned = (e & 1) || (e == 0);
11938 e_conv = DecodeError_clone(&e_conv);
11939 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11940 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
11941 return (uint64_t)ret_conv;
11944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11945 if ((_res & 1) != 0) return;
11946 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11948 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
11951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11952 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
11953 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11954 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
11955 return (uint64_t)ret_conv;
11958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11959 LDKFundingCreated o_conv;
11960 o_conv.inner = (void*)(o & (~1));
11961 o_conv.is_owned = (o & 1) || (o == 0);
11962 o_conv = FundingCreated_clone(&o_conv);
11963 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11964 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
11965 return (uint64_t)ret_conv;
11968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11969 LDKDecodeError e_conv;
11970 e_conv.inner = (void*)(e & (~1));
11971 e_conv.is_owned = (e & 1) || (e == 0);
11972 e_conv = DecodeError_clone(&e_conv);
11973 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11974 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
11975 return (uint64_t)ret_conv;
11978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11979 if ((_res & 1) != 0) return;
11980 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11982 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
11985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11986 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
11987 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11988 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
11989 return (uint64_t)ret_conv;
11992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11993 LDKFundingSigned o_conv;
11994 o_conv.inner = (void*)(o & (~1));
11995 o_conv.is_owned = (o & 1) || (o == 0);
11996 o_conv = FundingSigned_clone(&o_conv);
11997 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11998 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
11999 return (uint64_t)ret_conv;
12002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12003 LDKDecodeError e_conv;
12004 e_conv.inner = (void*)(e & (~1));
12005 e_conv.is_owned = (e & 1) || (e == 0);
12006 e_conv = DecodeError_clone(&e_conv);
12007 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12008 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
12009 return (uint64_t)ret_conv;
12012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12013 if ((_res & 1) != 0) return;
12014 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12016 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
12019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12020 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
12021 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12022 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
12023 return (uint64_t)ret_conv;
12026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12027 LDKFundingLocked o_conv;
12028 o_conv.inner = (void*)(o & (~1));
12029 o_conv.is_owned = (o & 1) || (o == 0);
12030 o_conv = FundingLocked_clone(&o_conv);
12031 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12032 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
12033 return (uint64_t)ret_conv;
12036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12037 LDKDecodeError e_conv;
12038 e_conv.inner = (void*)(e & (~1));
12039 e_conv.is_owned = (e & 1) || (e == 0);
12040 e_conv = DecodeError_clone(&e_conv);
12041 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12042 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
12043 return (uint64_t)ret_conv;
12046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12047 if ((_res & 1) != 0) return;
12048 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12050 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
12053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12054 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
12055 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12056 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
12057 return (uint64_t)ret_conv;
12060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12062 o_conv.inner = (void*)(o & (~1));
12063 o_conv.is_owned = (o & 1) || (o == 0);
12064 o_conv = Init_clone(&o_conv);
12065 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12066 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
12067 return (uint64_t)ret_conv;
12070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12071 LDKDecodeError e_conv;
12072 e_conv.inner = (void*)(e & (~1));
12073 e_conv.is_owned = (e & 1) || (e == 0);
12074 e_conv = DecodeError_clone(&e_conv);
12075 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12076 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
12077 return (uint64_t)ret_conv;
12080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12081 if ((_res & 1) != 0) return;
12082 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
12084 CResult_InitDecodeErrorZ_free(_res_conv);
12087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12088 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
12089 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12090 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
12091 return (uint64_t)ret_conv;
12094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12095 LDKOpenChannel o_conv;
12096 o_conv.inner = (void*)(o & (~1));
12097 o_conv.is_owned = (o & 1) || (o == 0);
12098 o_conv = OpenChannel_clone(&o_conv);
12099 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12100 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
12101 return (uint64_t)ret_conv;
12104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12105 LDKDecodeError e_conv;
12106 e_conv.inner = (void*)(e & (~1));
12107 e_conv.is_owned = (e & 1) || (e == 0);
12108 e_conv = DecodeError_clone(&e_conv);
12109 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12110 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
12111 return (uint64_t)ret_conv;
12114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12115 if ((_res & 1) != 0) return;
12116 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12118 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
12121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12122 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
12123 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12124 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
12125 return (uint64_t)ret_conv;
12128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12129 LDKRevokeAndACK o_conv;
12130 o_conv.inner = (void*)(o & (~1));
12131 o_conv.is_owned = (o & 1) || (o == 0);
12132 o_conv = RevokeAndACK_clone(&o_conv);
12133 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12134 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
12135 return (uint64_t)ret_conv;
12138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12139 LDKDecodeError e_conv;
12140 e_conv.inner = (void*)(e & (~1));
12141 e_conv.is_owned = (e & 1) || (e == 0);
12142 e_conv = DecodeError_clone(&e_conv);
12143 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12144 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
12145 return (uint64_t)ret_conv;
12148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12149 if ((_res & 1) != 0) return;
12150 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
12152 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
12155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12156 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
12157 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12158 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
12159 return (uint64_t)ret_conv;
12162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12163 LDKShutdown o_conv;
12164 o_conv.inner = (void*)(o & (~1));
12165 o_conv.is_owned = (o & 1) || (o == 0);
12166 o_conv = Shutdown_clone(&o_conv);
12167 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12168 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
12169 return (uint64_t)ret_conv;
12172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12173 LDKDecodeError e_conv;
12174 e_conv.inner = (void*)(e & (~1));
12175 e_conv.is_owned = (e & 1) || (e == 0);
12176 e_conv = DecodeError_clone(&e_conv);
12177 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12178 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
12179 return (uint64_t)ret_conv;
12182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12183 if ((_res & 1) != 0) return;
12184 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
12186 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12190 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12191 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12192 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12193 return (uint64_t)ret_conv;
12196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12197 LDKUpdateFailHTLC o_conv;
12198 o_conv.inner = (void*)(o & (~1));
12199 o_conv.is_owned = (o & 1) || (o == 0);
12200 o_conv = UpdateFailHTLC_clone(&o_conv);
12201 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12202 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12203 return (uint64_t)ret_conv;
12206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12207 LDKDecodeError e_conv;
12208 e_conv.inner = (void*)(e & (~1));
12209 e_conv.is_owned = (e & 1) || (e == 0);
12210 e_conv = DecodeError_clone(&e_conv);
12211 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12212 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12213 return (uint64_t)ret_conv;
12216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12217 if ((_res & 1) != 0) return;
12218 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12220 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12224 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12225 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12226 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12227 return (uint64_t)ret_conv;
12230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12231 LDKUpdateFailMalformedHTLC o_conv;
12232 o_conv.inner = (void*)(o & (~1));
12233 o_conv.is_owned = (o & 1) || (o == 0);
12234 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12235 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12236 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12237 return (uint64_t)ret_conv;
12240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12241 LDKDecodeError e_conv;
12242 e_conv.inner = (void*)(e & (~1));
12243 e_conv.is_owned = (e & 1) || (e == 0);
12244 e_conv = DecodeError_clone(&e_conv);
12245 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12246 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12247 return (uint64_t)ret_conv;
12250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12251 if ((_res & 1) != 0) return;
12252 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12254 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12258 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12259 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12260 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12261 return (uint64_t)ret_conv;
12264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12265 LDKUpdateFee o_conv;
12266 o_conv.inner = (void*)(o & (~1));
12267 o_conv.is_owned = (o & 1) || (o == 0);
12268 o_conv = UpdateFee_clone(&o_conv);
12269 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12270 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12271 return (uint64_t)ret_conv;
12274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12275 LDKDecodeError e_conv;
12276 e_conv.inner = (void*)(e & (~1));
12277 e_conv.is_owned = (e & 1) || (e == 0);
12278 e_conv = DecodeError_clone(&e_conv);
12279 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12280 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12281 return (uint64_t)ret_conv;
12284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12285 if ((_res & 1) != 0) return;
12286 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12288 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12292 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12293 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12294 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12295 return (uint64_t)ret_conv;
12298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12299 LDKUpdateFulfillHTLC o_conv;
12300 o_conv.inner = (void*)(o & (~1));
12301 o_conv.is_owned = (o & 1) || (o == 0);
12302 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12303 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12304 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12305 return (uint64_t)ret_conv;
12308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12309 LDKDecodeError e_conv;
12310 e_conv.inner = (void*)(e & (~1));
12311 e_conv.is_owned = (e & 1) || (e == 0);
12312 e_conv = DecodeError_clone(&e_conv);
12313 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12314 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12315 return (uint64_t)ret_conv;
12318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12319 if ((_res & 1) != 0) return;
12320 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12322 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12326 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12327 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12328 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
12329 return (uint64_t)ret_conv;
12332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12333 LDKUpdateAddHTLC o_conv;
12334 o_conv.inner = (void*)(o & (~1));
12335 o_conv.is_owned = (o & 1) || (o == 0);
12336 o_conv = UpdateAddHTLC_clone(&o_conv);
12337 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12338 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
12339 return (uint64_t)ret_conv;
12342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12343 LDKDecodeError e_conv;
12344 e_conv.inner = (void*)(e & (~1));
12345 e_conv.is_owned = (e & 1) || (e == 0);
12346 e_conv = DecodeError_clone(&e_conv);
12347 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12348 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
12349 return (uint64_t)ret_conv;
12352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12353 if ((_res & 1) != 0) return;
12354 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12356 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
12359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12360 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
12361 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12362 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
12363 return (uint64_t)ret_conv;
12366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12368 o_conv.inner = (void*)(o & (~1));
12369 o_conv.is_owned = (o & 1) || (o == 0);
12370 o_conv = Ping_clone(&o_conv);
12371 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12372 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
12373 return (uint64_t)ret_conv;
12376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12377 LDKDecodeError e_conv;
12378 e_conv.inner = (void*)(e & (~1));
12379 e_conv.is_owned = (e & 1) || (e == 0);
12380 e_conv = DecodeError_clone(&e_conv);
12381 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12382 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
12383 return (uint64_t)ret_conv;
12386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12387 if ((_res & 1) != 0) return;
12388 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
12390 CResult_PingDecodeErrorZ_free(_res_conv);
12393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12394 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
12395 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12396 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
12397 return (uint64_t)ret_conv;
12400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12402 o_conv.inner = (void*)(o & (~1));
12403 o_conv.is_owned = (o & 1) || (o == 0);
12404 o_conv = Pong_clone(&o_conv);
12405 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12406 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
12407 return (uint64_t)ret_conv;
12410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12411 LDKDecodeError e_conv;
12412 e_conv.inner = (void*)(e & (~1));
12413 e_conv.is_owned = (e & 1) || (e == 0);
12414 e_conv = DecodeError_clone(&e_conv);
12415 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12416 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
12417 return (uint64_t)ret_conv;
12420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12421 if ((_res & 1) != 0) return;
12422 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
12424 CResult_PongDecodeErrorZ_free(_res_conv);
12427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12428 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
12429 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12430 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
12431 return (uint64_t)ret_conv;
12434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12435 LDKUnsignedChannelAnnouncement o_conv;
12436 o_conv.inner = (void*)(o & (~1));
12437 o_conv.is_owned = (o & 1) || (o == 0);
12438 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
12439 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12440 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
12441 return (uint64_t)ret_conv;
12444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12445 LDKDecodeError e_conv;
12446 e_conv.inner = (void*)(e & (~1));
12447 e_conv.is_owned = (e & 1) || (e == 0);
12448 e_conv = DecodeError_clone(&e_conv);
12449 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12450 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
12451 return (uint64_t)ret_conv;
12454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12455 if ((_res & 1) != 0) return;
12456 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12458 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
12461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12462 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12463 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12464 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12465 return (uint64_t)ret_conv;
12468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12469 LDKChannelAnnouncement o_conv;
12470 o_conv.inner = (void*)(o & (~1));
12471 o_conv.is_owned = (o & 1) || (o == 0);
12472 o_conv = ChannelAnnouncement_clone(&o_conv);
12473 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12474 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
12475 return (uint64_t)ret_conv;
12478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12479 LDKDecodeError e_conv;
12480 e_conv.inner = (void*)(e & (~1));
12481 e_conv.is_owned = (e & 1) || (e == 0);
12482 e_conv = DecodeError_clone(&e_conv);
12483 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12484 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
12485 return (uint64_t)ret_conv;
12488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12489 if ((_res & 1) != 0) return;
12490 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12492 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
12495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12496 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12497 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12498 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12499 return (uint64_t)ret_conv;
12502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12503 LDKUnsignedChannelUpdate o_conv;
12504 o_conv.inner = (void*)(o & (~1));
12505 o_conv.is_owned = (o & 1) || (o == 0);
12506 o_conv = UnsignedChannelUpdate_clone(&o_conv);
12507 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12508 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
12509 return (uint64_t)ret_conv;
12512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12513 LDKDecodeError e_conv;
12514 e_conv.inner = (void*)(e & (~1));
12515 e_conv.is_owned = (e & 1) || (e == 0);
12516 e_conv = DecodeError_clone(&e_conv);
12517 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12518 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
12519 return (uint64_t)ret_conv;
12522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12523 if ((_res & 1) != 0) return;
12524 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12526 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
12529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12530 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
12531 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12532 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
12533 return (uint64_t)ret_conv;
12536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12537 LDKChannelUpdate o_conv;
12538 o_conv.inner = (void*)(o & (~1));
12539 o_conv.is_owned = (o & 1) || (o == 0);
12540 o_conv = ChannelUpdate_clone(&o_conv);
12541 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12542 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
12543 return (uint64_t)ret_conv;
12546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12547 LDKDecodeError e_conv;
12548 e_conv.inner = (void*)(e & (~1));
12549 e_conv.is_owned = (e & 1) || (e == 0);
12550 e_conv = DecodeError_clone(&e_conv);
12551 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12552 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
12553 return (uint64_t)ret_conv;
12556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12557 if ((_res & 1) != 0) return;
12558 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12560 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
12563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12564 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
12565 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12566 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
12567 return (uint64_t)ret_conv;
12570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12571 LDKErrorMessage o_conv;
12572 o_conv.inner = (void*)(o & (~1));
12573 o_conv.is_owned = (o & 1) || (o == 0);
12574 o_conv = ErrorMessage_clone(&o_conv);
12575 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12576 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
12577 return (uint64_t)ret_conv;
12580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12581 LDKDecodeError e_conv;
12582 e_conv.inner = (void*)(e & (~1));
12583 e_conv.is_owned = (e & 1) || (e == 0);
12584 e_conv = DecodeError_clone(&e_conv);
12585 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12586 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
12587 return (uint64_t)ret_conv;
12590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12591 if ((_res & 1) != 0) return;
12592 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
12594 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
12597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12598 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
12599 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12600 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
12601 return (uint64_t)ret_conv;
12604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12605 LDKUnsignedNodeAnnouncement o_conv;
12606 o_conv.inner = (void*)(o & (~1));
12607 o_conv.is_owned = (o & 1) || (o == 0);
12608 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
12609 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12610 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
12611 return (uint64_t)ret_conv;
12614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12615 LDKDecodeError e_conv;
12616 e_conv.inner = (void*)(e & (~1));
12617 e_conv.is_owned = (e & 1) || (e == 0);
12618 e_conv = DecodeError_clone(&e_conv);
12619 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12620 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
12621 return (uint64_t)ret_conv;
12624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12625 if ((_res & 1) != 0) return;
12626 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12628 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
12631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12632 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
12633 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12634 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
12635 return (uint64_t)ret_conv;
12638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12639 LDKNodeAnnouncement o_conv;
12640 o_conv.inner = (void*)(o & (~1));
12641 o_conv.is_owned = (o & 1) || (o == 0);
12642 o_conv = NodeAnnouncement_clone(&o_conv);
12643 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12644 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
12645 return (uint64_t)ret_conv;
12648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12649 LDKDecodeError e_conv;
12650 e_conv.inner = (void*)(e & (~1));
12651 e_conv.is_owned = (e & 1) || (e == 0);
12652 e_conv = DecodeError_clone(&e_conv);
12653 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12654 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
12655 return (uint64_t)ret_conv;
12658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12659 if ((_res & 1) != 0) return;
12660 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12662 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
12665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12666 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
12667 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12668 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
12669 return (uint64_t)ret_conv;
12672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12673 LDKQueryShortChannelIds o_conv;
12674 o_conv.inner = (void*)(o & (~1));
12675 o_conv.is_owned = (o & 1) || (o == 0);
12676 o_conv = QueryShortChannelIds_clone(&o_conv);
12677 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12678 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
12679 return (uint64_t)ret_conv;
12682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12683 LDKDecodeError e_conv;
12684 e_conv.inner = (void*)(e & (~1));
12685 e_conv.is_owned = (e & 1) || (e == 0);
12686 e_conv = DecodeError_clone(&e_conv);
12687 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12688 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
12689 return (uint64_t)ret_conv;
12692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12693 if ((_res & 1) != 0) return;
12694 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
12696 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
12699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12700 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
12701 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12702 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
12703 return (uint64_t)ret_conv;
12706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12707 LDKReplyShortChannelIdsEnd o_conv;
12708 o_conv.inner = (void*)(o & (~1));
12709 o_conv.is_owned = (o & 1) || (o == 0);
12710 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
12711 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12712 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
12713 return (uint64_t)ret_conv;
12716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12717 LDKDecodeError e_conv;
12718 e_conv.inner = (void*)(e & (~1));
12719 e_conv.is_owned = (e & 1) || (e == 0);
12720 e_conv = DecodeError_clone(&e_conv);
12721 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12722 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
12723 return (uint64_t)ret_conv;
12726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12727 if ((_res & 1) != 0) return;
12728 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
12730 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
12733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12734 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
12735 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12736 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
12737 return (uint64_t)ret_conv;
12740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12741 LDKQueryChannelRange o_conv;
12742 o_conv.inner = (void*)(o & (~1));
12743 o_conv.is_owned = (o & 1) || (o == 0);
12744 o_conv = QueryChannelRange_clone(&o_conv);
12745 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12746 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
12747 return (uint64_t)ret_conv;
12750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12751 LDKDecodeError e_conv;
12752 e_conv.inner = (void*)(e & (~1));
12753 e_conv.is_owned = (e & 1) || (e == 0);
12754 e_conv = DecodeError_clone(&e_conv);
12755 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12756 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
12757 return (uint64_t)ret_conv;
12760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12761 if ((_res & 1) != 0) return;
12762 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12764 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
12767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12768 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
12769 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12770 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
12771 return (uint64_t)ret_conv;
12774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12775 LDKReplyChannelRange o_conv;
12776 o_conv.inner = (void*)(o & (~1));
12777 o_conv.is_owned = (o & 1) || (o == 0);
12778 o_conv = ReplyChannelRange_clone(&o_conv);
12779 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12780 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
12781 return (uint64_t)ret_conv;
12784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12785 LDKDecodeError e_conv;
12786 e_conv.inner = (void*)(e & (~1));
12787 e_conv.is_owned = (e & 1) || (e == 0);
12788 e_conv = DecodeError_clone(&e_conv);
12789 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12790 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
12791 return (uint64_t)ret_conv;
12794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12795 if ((_res & 1) != 0) return;
12796 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12798 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
12801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12802 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
12803 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12804 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
12805 return (uint64_t)ret_conv;
12808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12809 LDKGossipTimestampFilter o_conv;
12810 o_conv.inner = (void*)(o & (~1));
12811 o_conv.is_owned = (o & 1) || (o == 0);
12812 o_conv = GossipTimestampFilter_clone(&o_conv);
12813 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12814 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
12815 return (uint64_t)ret_conv;
12818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12819 LDKDecodeError e_conv;
12820 e_conv.inner = (void*)(e & (~1));
12821 e_conv.is_owned = (e & 1) || (e == 0);
12822 e_conv = DecodeError_clone(&e_conv);
12823 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12824 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
12825 return (uint64_t)ret_conv;
12828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12829 if ((_res & 1) != 0) return;
12830 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
12832 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
12835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12836 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
12837 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12838 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
12839 return (uint64_t)ret_conv;
12842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12844 o_conv.inner = (void*)(o & (~1));
12845 o_conv.is_owned = (o & 1) || (o == 0);
12846 o_conv = Invoice_clone(&o_conv);
12847 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12848 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
12849 return (uint64_t)ret_conv;
12852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12853 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
12854 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12855 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
12856 return (uint64_t)ret_conv;
12859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12860 if ((_res & 1) != 0) return;
12861 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
12863 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
12866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12867 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
12868 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12869 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
12870 return (uint64_t)ret_conv;
12873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12874 if ((this_ptr & 1) != 0) return;
12875 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
12876 FREE((void*)this_ptr);
12877 Event_free(this_ptr_conv);
12880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12881 LDKEvent* orig_conv = (LDKEvent*)orig;
12882 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12883 *ret_copy = Event_clone(orig_conv);
12884 uint64_t ret_ref = (uint64_t)ret_copy;
12888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
12889 LDKEvent* obj_conv = (LDKEvent*)obj;
12890 LDKCVec_u8Z ret_var = Event_write(obj_conv);
12891 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12892 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12893 CVec_u8Z_free(ret_var);
12897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12898 if ((this_ptr & 1) != 0) return;
12899 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
12900 FREE((void*)this_ptr);
12901 MessageSendEvent_free(this_ptr_conv);
12904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12905 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
12906 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12907 *ret_copy = MessageSendEvent_clone(orig_conv);
12908 uint64_t ret_ref = (uint64_t)ret_copy;
12912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12913 if ((this_ptr & 1) != 0) return;
12914 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
12915 FREE((void*)this_ptr);
12916 MessageSendEventsProvider_free(this_ptr_conv);
12919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12920 if ((this_ptr & 1) != 0) return;
12921 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
12922 FREE((void*)this_ptr);
12923 EventsProvider_free(this_ptr_conv);
12926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12927 if ((this_ptr & 1) != 0) return;
12928 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
12929 FREE((void*)this_ptr);
12930 EventHandler_free(this_ptr_conv);
12933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12934 if ((this_ptr & 1) != 0) return;
12935 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
12936 FREE((void*)this_ptr);
12937 APIError_free(this_ptr_conv);
12940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12941 LDKAPIError* orig_conv = (LDKAPIError*)orig;
12942 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12943 *ret_copy = APIError_clone(orig_conv);
12944 uint64_t ret_ref = (uint64_t)ret_copy;
12948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
12949 LDKu8slice msg_ref;
12950 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12951 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12952 LDKSecretKey sk_ref;
12953 CHECK((*env)->GetArrayLength(env, sk) == 32);
12954 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_ref.bytes);
12955 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12956 *ret_conv = sign(msg_ref, sk_ref);
12957 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12958 return (uint64_t)ret_conv;
12961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
12962 LDKu8slice msg_ref;
12963 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12964 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12965 LDKStr sig_conv = java_to_owned_str(env, sig);
12966 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
12967 *ret_conv = recover_pk(msg_ref, sig_conv);
12968 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12969 return (uint64_t)ret_conv;
12972 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
12973 LDKu8slice msg_ref;
12974 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12975 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12976 LDKStr sig_conv = java_to_owned_str(env, sig);
12977 LDKPublicKey pk_ref;
12978 CHECK((*env)->GetArrayLength(env, pk) == 33);
12979 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
12980 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
12981 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12985 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12986 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
12987 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
12991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
12992 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
12993 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
12994 jboolean ret_val = Level_eq(a_conv, b_conv);
12998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
12999 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
13000 int64_t ret_val = Level_hash(o_conv);
13004 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
13005 jclass ret_conv = LDKLevel_to_java(env, Level_max());
13009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13010 if ((this_ptr & 1) != 0) return;
13011 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
13012 FREE((void*)this_ptr);
13013 Logger_free(this_ptr_conv);
13016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13017 LDKChannelHandshakeConfig this_obj_conv;
13018 this_obj_conv.inner = (void*)(this_obj & (~1));
13019 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13020 ChannelHandshakeConfig_free(this_obj_conv);
13023 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13024 LDKChannelHandshakeConfig this_ptr_conv;
13025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13026 this_ptr_conv.is_owned = false;
13027 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
13031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13032 LDKChannelHandshakeConfig this_ptr_conv;
13033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13034 this_ptr_conv.is_owned = false;
13035 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
13038 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13039 LDKChannelHandshakeConfig this_ptr_conv;
13040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13041 this_ptr_conv.is_owned = false;
13042 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
13046 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) {
13047 LDKChannelHandshakeConfig this_ptr_conv;
13048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13049 this_ptr_conv.is_owned = false;
13050 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
13053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13054 LDKChannelHandshakeConfig this_ptr_conv;
13055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13056 this_ptr_conv.is_owned = false;
13057 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
13061 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) {
13062 LDKChannelHandshakeConfig this_ptr_conv;
13063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13064 this_ptr_conv.is_owned = false;
13065 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
13068 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) {
13069 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
13070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13072 uint64_t ret_ref = (uint64_t)ret_var.inner;
13073 if (ret_var.is_owned) {
13079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13080 LDKChannelHandshakeConfig orig_conv;
13081 orig_conv.inner = (void*)(orig & (~1));
13082 orig_conv.is_owned = false;
13083 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
13084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13086 uint64_t ret_ref = (uint64_t)ret_var.inner;
13087 if (ret_var.is_owned) {
13093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
13094 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
13095 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13096 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13097 uint64_t ret_ref = (uint64_t)ret_var.inner;
13098 if (ret_var.is_owned) {
13104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13105 LDKChannelHandshakeLimits this_obj_conv;
13106 this_obj_conv.inner = (void*)(this_obj & (~1));
13107 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13108 ChannelHandshakeLimits_free(this_obj_conv);
13111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13112 LDKChannelHandshakeLimits this_ptr_conv;
13113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13114 this_ptr_conv.is_owned = false;
13115 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
13119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13120 LDKChannelHandshakeLimits this_ptr_conv;
13121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13122 this_ptr_conv.is_owned = false;
13123 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
13126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13127 LDKChannelHandshakeLimits this_ptr_conv;
13128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13129 this_ptr_conv.is_owned = false;
13130 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
13134 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) {
13135 LDKChannelHandshakeLimits this_ptr_conv;
13136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13137 this_ptr_conv.is_owned = false;
13138 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
13141 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) {
13142 LDKChannelHandshakeLimits this_ptr_conv;
13143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13144 this_ptr_conv.is_owned = false;
13145 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
13149 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) {
13150 LDKChannelHandshakeLimits this_ptr_conv;
13151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13152 this_ptr_conv.is_owned = false;
13153 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13157 LDKChannelHandshakeLimits this_ptr_conv;
13158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13159 this_ptr_conv.is_owned = false;
13160 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
13164 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) {
13165 LDKChannelHandshakeLimits this_ptr_conv;
13166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13167 this_ptr_conv.is_owned = false;
13168 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
13171 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13172 LDKChannelHandshakeLimits this_ptr_conv;
13173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13174 this_ptr_conv.is_owned = false;
13175 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
13179 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) {
13180 LDKChannelHandshakeLimits this_ptr_conv;
13181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13182 this_ptr_conv.is_owned = false;
13183 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
13186 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13187 LDKChannelHandshakeLimits this_ptr_conv;
13188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13189 this_ptr_conv.is_owned = false;
13190 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
13194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13195 LDKChannelHandshakeLimits this_ptr_conv;
13196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13197 this_ptr_conv.is_owned = false;
13198 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
13201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
13202 LDKChannelHandshakeLimits this_ptr_conv;
13203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13204 this_ptr_conv.is_owned = false;
13205 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
13209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13210 LDKChannelHandshakeLimits this_ptr_conv;
13211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13212 this_ptr_conv.is_owned = false;
13213 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
13216 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13217 LDKChannelHandshakeLimits this_ptr_conv;
13218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13219 this_ptr_conv.is_owned = false;
13220 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
13224 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) {
13225 LDKChannelHandshakeLimits this_ptr_conv;
13226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13227 this_ptr_conv.is_owned = false;
13228 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
13231 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) {
13232 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);
13233 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13234 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13235 uint64_t ret_ref = (uint64_t)ret_var.inner;
13236 if (ret_var.is_owned) {
13242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13243 LDKChannelHandshakeLimits orig_conv;
13244 orig_conv.inner = (void*)(orig & (~1));
13245 orig_conv.is_owned = false;
13246 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
13247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13249 uint64_t ret_ref = (uint64_t)ret_var.inner;
13250 if (ret_var.is_owned) {
13256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
13257 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
13258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13260 uint64_t ret_ref = (uint64_t)ret_var.inner;
13261 if (ret_var.is_owned) {
13267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13268 LDKChannelConfig this_obj_conv;
13269 this_obj_conv.inner = (void*)(this_obj & (~1));
13270 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13271 ChannelConfig_free(this_obj_conv);
13274 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
13275 LDKChannelConfig this_ptr_conv;
13276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13277 this_ptr_conv.is_owned = false;
13278 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
13282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13283 LDKChannelConfig this_ptr_conv;
13284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13285 this_ptr_conv.is_owned = false;
13286 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
13289 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
13290 LDKChannelConfig this_ptr_conv;
13291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13292 this_ptr_conv.is_owned = false;
13293 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
13297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13298 LDKChannelConfig this_ptr_conv;
13299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13300 this_ptr_conv.is_owned = false;
13301 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
13304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
13305 LDKChannelConfig this_ptr_conv;
13306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13307 this_ptr_conv.is_owned = false;
13308 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
13312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13313 LDKChannelConfig this_ptr_conv;
13314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13315 this_ptr_conv.is_owned = false;
13316 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
13319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13320 LDKChannelConfig this_ptr_conv;
13321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13322 this_ptr_conv.is_owned = false;
13323 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
13327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13328 LDKChannelConfig this_ptr_conv;
13329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13330 this_ptr_conv.is_owned = false;
13331 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
13334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
13335 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
13336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13338 uint64_t ret_ref = (uint64_t)ret_var.inner;
13339 if (ret_var.is_owned) {
13345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13346 LDKChannelConfig orig_conv;
13347 orig_conv.inner = (void*)(orig & (~1));
13348 orig_conv.is_owned = false;
13349 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
13350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13352 uint64_t ret_ref = (uint64_t)ret_var.inner;
13353 if (ret_var.is_owned) {
13359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
13360 LDKChannelConfig ret_var = ChannelConfig_default();
13361 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13362 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13363 uint64_t ret_ref = (uint64_t)ret_var.inner;
13364 if (ret_var.is_owned) {
13370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
13371 LDKChannelConfig obj_conv;
13372 obj_conv.inner = (void*)(obj & (~1));
13373 obj_conv.is_owned = false;
13374 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13375 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13376 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13377 CVec_u8Z_free(ret_var);
13381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13382 LDKu8slice ser_ref;
13383 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13384 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13385 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13386 *ret_conv = ChannelConfig_read(ser_ref);
13387 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13388 return (uint64_t)ret_conv;
13391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13392 LDKUserConfig this_obj_conv;
13393 this_obj_conv.inner = (void*)(this_obj & (~1));
13394 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13395 UserConfig_free(this_obj_conv);
13398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
13399 LDKUserConfig this_ptr_conv;
13400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13401 this_ptr_conv.is_owned = false;
13402 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
13403 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13404 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13405 uint64_t ret_ref = (uint64_t)ret_var.inner;
13406 if (ret_var.is_owned) {
13412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13413 LDKUserConfig this_ptr_conv;
13414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13415 this_ptr_conv.is_owned = false;
13416 LDKChannelHandshakeConfig val_conv;
13417 val_conv.inner = (void*)(val & (~1));
13418 val_conv.is_owned = (val & 1) || (val == 0);
13419 val_conv = ChannelHandshakeConfig_clone(&val_conv);
13420 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
13423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
13424 LDKUserConfig this_ptr_conv;
13425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13426 this_ptr_conv.is_owned = false;
13427 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
13428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13430 uint64_t ret_ref = (uint64_t)ret_var.inner;
13431 if (ret_var.is_owned) {
13437 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) {
13438 LDKUserConfig this_ptr_conv;
13439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13440 this_ptr_conv.is_owned = false;
13441 LDKChannelHandshakeLimits val_conv;
13442 val_conv.inner = (void*)(val & (~1));
13443 val_conv.is_owned = (val & 1) || (val == 0);
13444 val_conv = ChannelHandshakeLimits_clone(&val_conv);
13445 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
13448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
13449 LDKUserConfig this_ptr_conv;
13450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13451 this_ptr_conv.is_owned = false;
13452 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
13453 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13454 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13455 uint64_t ret_ref = (uint64_t)ret_var.inner;
13456 if (ret_var.is_owned) {
13462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13463 LDKUserConfig this_ptr_conv;
13464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13465 this_ptr_conv.is_owned = false;
13466 LDKChannelConfig val_conv;
13467 val_conv.inner = (void*)(val & (~1));
13468 val_conv.is_owned = (val & 1) || (val == 0);
13469 val_conv = ChannelConfig_clone(&val_conv);
13470 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
13473 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) {
13474 LDKChannelHandshakeConfig own_channel_config_arg_conv;
13475 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
13476 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
13477 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
13478 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
13479 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
13480 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
13481 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
13482 LDKChannelConfig channel_options_arg_conv;
13483 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
13484 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
13485 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
13486 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
13487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13489 uint64_t ret_ref = (uint64_t)ret_var.inner;
13490 if (ret_var.is_owned) {
13496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13497 LDKUserConfig orig_conv;
13498 orig_conv.inner = (void*)(orig & (~1));
13499 orig_conv.is_owned = false;
13500 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
13501 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13502 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13503 uint64_t ret_ref = (uint64_t)ret_var.inner;
13504 if (ret_var.is_owned) {
13510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
13511 LDKUserConfig ret_var = UserConfig_default();
13512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13514 uint64_t ret_ref = (uint64_t)ret_var.inner;
13515 if (ret_var.is_owned) {
13521 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13522 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
13523 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
13527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13528 if ((this_ptr & 1) != 0) return;
13529 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
13530 FREE((void*)this_ptr);
13531 Access_free(this_ptr_conv);
13534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13535 if ((this_ptr & 1) != 0) return;
13536 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
13537 FREE((void*)this_ptr);
13538 Listen_free(this_ptr_conv);
13541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13542 if ((this_ptr & 1) != 0) return;
13543 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
13544 FREE((void*)this_ptr);
13545 Confirm_free(this_ptr_conv);
13548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13549 if ((this_ptr & 1) != 0) return;
13550 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
13551 FREE((void*)this_ptr);
13552 Watch_free(this_ptr_conv);
13555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13556 if ((this_ptr & 1) != 0) return;
13557 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
13558 FREE((void*)this_ptr);
13559 Filter_free(this_ptr_conv);
13562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13563 LDKWatchedOutput this_obj_conv;
13564 this_obj_conv.inner = (void*)(this_obj & (~1));
13565 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13566 WatchedOutput_free(this_obj_conv);
13569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13570 LDKWatchedOutput this_ptr_conv;
13571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13572 this_ptr_conv.is_owned = false;
13573 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13574 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
13578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13579 LDKWatchedOutput this_ptr_conv;
13580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13581 this_ptr_conv.is_owned = false;
13582 LDKThirtyTwoBytes val_ref;
13583 CHECK((*env)->GetArrayLength(env, val) == 32);
13584 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13585 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
13588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13589 LDKWatchedOutput this_ptr_conv;
13590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13591 this_ptr_conv.is_owned = false;
13592 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
13593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13595 uint64_t ret_ref = (uint64_t)ret_var.inner;
13596 if (ret_var.is_owned) {
13602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13603 LDKWatchedOutput this_ptr_conv;
13604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13605 this_ptr_conv.is_owned = false;
13606 LDKOutPoint val_conv;
13607 val_conv.inner = (void*)(val & (~1));
13608 val_conv.is_owned = (val & 1) || (val == 0);
13609 val_conv = OutPoint_clone(&val_conv);
13610 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
13613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13614 LDKWatchedOutput this_ptr_conv;
13615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13616 this_ptr_conv.is_owned = false;
13617 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
13618 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13619 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13624 LDKWatchedOutput this_ptr_conv;
13625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13626 this_ptr_conv.is_owned = false;
13627 LDKCVec_u8Z val_ref;
13628 val_ref.datalen = (*env)->GetArrayLength(env, val);
13629 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13630 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
13631 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
13634 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) {
13635 LDKThirtyTwoBytes block_hash_arg_ref;
13636 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
13637 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
13638 LDKOutPoint outpoint_arg_conv;
13639 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13640 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13641 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13642 LDKCVec_u8Z script_pubkey_arg_ref;
13643 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
13644 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13645 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
13646 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
13647 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13648 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13649 uint64_t ret_ref = (uint64_t)ret_var.inner;
13650 if (ret_var.is_owned) {
13656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13657 LDKWatchedOutput orig_conv;
13658 orig_conv.inner = (void*)(orig & (~1));
13659 orig_conv.is_owned = false;
13660 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
13661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13663 uint64_t ret_ref = (uint64_t)ret_var.inner;
13664 if (ret_var.is_owned) {
13670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
13671 LDKWatchedOutput o_conv;
13672 o_conv.inner = (void*)(o & (~1));
13673 o_conv.is_owned = false;
13674 int64_t ret_val = WatchedOutput_hash(&o_conv);
13678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13679 if ((this_ptr & 1) != 0) return;
13680 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
13681 FREE((void*)this_ptr);
13682 BroadcasterInterface_free(this_ptr_conv);
13685 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13686 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
13687 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
13691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13692 if ((this_ptr & 1) != 0) return;
13693 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
13694 FREE((void*)this_ptr);
13695 FeeEstimator_free(this_ptr_conv);
13698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13699 LDKChainMonitor this_obj_conv;
13700 this_obj_conv.inner = (void*)(this_obj & (~1));
13701 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13702 ChainMonitor_free(this_obj_conv);
13705 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) {
13706 LDKFilter *chain_source_conv_ptr = NULL;
13707 if (chain_source != 0) {
13708 LDKFilter chain_source_conv;
13709 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
13710 if (chain_source_conv.free == LDKFilter_JCalls_free) {
13711 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13712 LDKFilter_JCalls_clone(chain_source_conv.this_arg);
13714 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13715 *chain_source_conv_ptr = chain_source_conv;
13717 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13718 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
13719 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13720 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
13722 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13723 if (logger_conv.free == LDKLogger_JCalls_free) {
13724 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13725 LDKLogger_JCalls_clone(logger_conv.this_arg);
13727 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
13728 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
13729 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13730 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
13732 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
13733 if (persister_conv.free == LDKPersist_JCalls_free) {
13734 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13735 LDKPersist_JCalls_clone(persister_conv.this_arg);
13737 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
13738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13740 uint64_t ret_ref = (uint64_t)ret_var.inner;
13741 if (ret_var.is_owned) {
13747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
13748 LDKChainMonitor this_arg_conv;
13749 this_arg_conv.inner = (void*)(this_arg & (~1));
13750 this_arg_conv.is_owned = false;
13751 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
13752 *ret = ChainMonitor_as_Listen(&this_arg_conv);
13753 return (uint64_t)ret;
13756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
13757 LDKChainMonitor this_arg_conv;
13758 this_arg_conv.inner = (void*)(this_arg & (~1));
13759 this_arg_conv.is_owned = false;
13760 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13761 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
13762 return (uint64_t)ret;
13765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
13766 LDKChainMonitor this_arg_conv;
13767 this_arg_conv.inner = (void*)(this_arg & (~1));
13768 this_arg_conv.is_owned = false;
13769 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
13770 *ret = ChainMonitor_as_Watch(&this_arg_conv);
13771 return (uint64_t)ret;
13774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
13775 LDKChainMonitor this_arg_conv;
13776 this_arg_conv.inner = (void*)(this_arg & (~1));
13777 this_arg_conv.is_owned = false;
13778 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13779 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
13780 return (uint64_t)ret;
13783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13784 LDKChannelMonitorUpdate this_obj_conv;
13785 this_obj_conv.inner = (void*)(this_obj & (~1));
13786 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13787 ChannelMonitorUpdate_free(this_obj_conv);
13790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13791 LDKChannelMonitorUpdate this_ptr_conv;
13792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13793 this_ptr_conv.is_owned = false;
13794 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
13798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13799 LDKChannelMonitorUpdate this_ptr_conv;
13800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13801 this_ptr_conv.is_owned = false;
13802 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
13805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13806 LDKChannelMonitorUpdate orig_conv;
13807 orig_conv.inner = (void*)(orig & (~1));
13808 orig_conv.is_owned = false;
13809 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
13810 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13811 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13812 uint64_t ret_ref = (uint64_t)ret_var.inner;
13813 if (ret_var.is_owned) {
13819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13820 LDKChannelMonitorUpdate obj_conv;
13821 obj_conv.inner = (void*)(obj & (~1));
13822 obj_conv.is_owned = false;
13823 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
13824 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13825 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13826 CVec_u8Z_free(ret_var);
13830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13831 LDKu8slice ser_ref;
13832 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13833 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13834 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13835 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
13836 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13837 return (uint64_t)ret_conv;
13840 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13841 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
13842 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
13846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13847 LDKMonitorUpdateError this_obj_conv;
13848 this_obj_conv.inner = (void*)(this_obj & (~1));
13849 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13850 MonitorUpdateError_free(this_obj_conv);
13853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13854 LDKMonitorUpdateError orig_conv;
13855 orig_conv.inner = (void*)(orig & (~1));
13856 orig_conv.is_owned = false;
13857 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
13858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13860 uint64_t ret_ref = (uint64_t)ret_var.inner;
13861 if (ret_var.is_owned) {
13867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13868 if ((this_ptr & 1) != 0) return;
13869 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
13870 FREE((void*)this_ptr);
13871 MonitorEvent_free(this_ptr_conv);
13874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13875 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
13876 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13877 *ret_copy = MonitorEvent_clone(orig_conv);
13878 uint64_t ret_ref = (uint64_t)ret_copy;
13882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13883 LDKHTLCUpdate this_obj_conv;
13884 this_obj_conv.inner = (void*)(this_obj & (~1));
13885 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13886 HTLCUpdate_free(this_obj_conv);
13889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13890 LDKHTLCUpdate orig_conv;
13891 orig_conv.inner = (void*)(orig & (~1));
13892 orig_conv.is_owned = false;
13893 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
13894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13896 uint64_t ret_ref = (uint64_t)ret_var.inner;
13897 if (ret_var.is_owned) {
13903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13904 LDKHTLCUpdate obj_conv;
13905 obj_conv.inner = (void*)(obj & (~1));
13906 obj_conv.is_owned = false;
13907 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
13908 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13909 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13910 CVec_u8Z_free(ret_var);
13914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13915 LDKu8slice ser_ref;
13916 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13917 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13918 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13919 *ret_conv = HTLCUpdate_read(ser_ref);
13920 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13921 return (uint64_t)ret_conv;
13924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13925 LDKChannelMonitor this_obj_conv;
13926 this_obj_conv.inner = (void*)(this_obj & (~1));
13927 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13928 ChannelMonitor_free(this_obj_conv);
13931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13932 LDKChannelMonitor orig_conv;
13933 orig_conv.inner = (void*)(orig & (~1));
13934 orig_conv.is_owned = false;
13935 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
13936 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13937 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13938 uint64_t ret_ref = (uint64_t)ret_var.inner;
13939 if (ret_var.is_owned) {
13945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
13946 LDKChannelMonitor obj_conv;
13947 obj_conv.inner = (void*)(obj & (~1));
13948 obj_conv.is_owned = false;
13949 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
13950 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13951 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13952 CVec_u8Z_free(ret_var);
13956 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) {
13957 LDKChannelMonitor this_arg_conv;
13958 this_arg_conv.inner = (void*)(this_arg & (~1));
13959 this_arg_conv.is_owned = false;
13960 LDKChannelMonitorUpdate updates_conv;
13961 updates_conv.inner = (void*)(updates & (~1));
13962 updates_conv.is_owned = false;
13963 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13964 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13965 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
13966 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13967 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
13968 return (uint64_t)ret_conv;
13971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13972 LDKChannelMonitor this_arg_conv;
13973 this_arg_conv.inner = (void*)(this_arg & (~1));
13974 this_arg_conv.is_owned = false;
13975 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
13979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
13980 LDKChannelMonitor this_arg_conv;
13981 this_arg_conv.inner = (void*)(this_arg & (~1));
13982 this_arg_conv.is_owned = false;
13983 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13984 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
13985 return (uint64_t)ret_ref;
13988 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
13989 LDKChannelMonitor this_arg_conv;
13990 this_arg_conv.inner = (void*)(this_arg & (~1));
13991 this_arg_conv.is_owned = false;
13992 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
13993 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13994 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13995 for (size_t v = 0; v < ret_var.datalen; v++) {
13996 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13997 *ret_conv_47_ref = ret_var.data[v];
13998 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
14000 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14001 FREE(ret_var.data);
14005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
14006 LDKChannelMonitor this_arg_conv;
14007 this_arg_conv.inner = (void*)(this_arg & (~1));
14008 this_arg_conv.is_owned = false;
14009 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
14010 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
14013 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14014 LDKChannelMonitor this_arg_conv;
14015 this_arg_conv.inner = (void*)(this_arg & (~1));
14016 this_arg_conv.is_owned = false;
14017 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
14018 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14019 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14020 for (size_t o = 0; o < ret_var.datalen; o++) {
14021 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14022 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
14023 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
14024 ret_arr_ptr[o] = ret_conv_14_ref;
14026 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14027 FREE(ret_var.data);
14031 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14032 LDKChannelMonitor this_arg_conv;
14033 this_arg_conv.inner = (void*)(this_arg & (~1));
14034 this_arg_conv.is_owned = false;
14035 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
14036 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14037 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14038 for (size_t h = 0; h < ret_var.datalen; h++) {
14039 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14040 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
14041 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
14042 ret_arr_ptr[h] = ret_conv_7_ref;
14044 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14045 FREE(ret_var.data);
14049 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) {
14050 LDKChannelMonitor this_arg_conv;
14051 this_arg_conv.inner = (void*)(this_arg & (~1));
14052 this_arg_conv.is_owned = false;
14053 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14054 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
14055 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14057 for (size_t i = 0; i < ret_var.datalen; i++) {
14058 LDKTransaction ret_conv_8_var = ret_var.data[i];
14059 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
14060 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
14061 Transaction_free(ret_conv_8_var);
14062 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14064 FREE(ret_var.data);
14068 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) {
14069 LDKChannelMonitor this_arg_conv;
14070 this_arg_conv.inner = (void*)(this_arg & (~1));
14071 this_arg_conv.is_owned = false;
14072 unsigned char header_arr[80];
14073 CHECK((*env)->GetArrayLength(env, header) == 80);
14074 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14075 unsigned char (*header_ref)[80] = &header_arr;
14076 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14077 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14078 if (txdata_constr.datalen > 0)
14079 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14081 txdata_constr.data = NULL;
14082 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14083 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14084 int64_t txdata_conv_24 = txdata_vals[y];
14085 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14086 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14087 txdata_constr.data[y] = txdata_conv_24_conv;
14089 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14090 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14091 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14092 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14093 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14095 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14096 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14097 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14098 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14100 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14101 if (logger_conv.free == LDKLogger_JCalls_free) {
14102 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14103 LDKLogger_JCalls_clone(logger_conv.this_arg);
14105 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);
14106 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14107 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14108 for (size_t u = 0; u < ret_var.datalen; u++) {
14109 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14110 *ret_conv_46_ref = ret_var.data[u];
14111 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14113 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14114 FREE(ret_var.data);
14118 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) {
14119 LDKChannelMonitor this_arg_conv;
14120 this_arg_conv.inner = (void*)(this_arg & (~1));
14121 this_arg_conv.is_owned = false;
14122 unsigned char header_arr[80];
14123 CHECK((*env)->GetArrayLength(env, header) == 80);
14124 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14125 unsigned char (*header_ref)[80] = &header_arr;
14126 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14127 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14128 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14129 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14131 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14132 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14133 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14134 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14136 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14137 if (logger_conv.free == LDKLogger_JCalls_free) {
14138 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14139 LDKLogger_JCalls_clone(logger_conv.this_arg);
14141 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14144 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) {
14145 LDKChannelMonitor this_arg_conv;
14146 this_arg_conv.inner = (void*)(this_arg & (~1));
14147 this_arg_conv.is_owned = false;
14148 unsigned char header_arr[80];
14149 CHECK((*env)->GetArrayLength(env, header) == 80);
14150 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14151 unsigned char (*header_ref)[80] = &header_arr;
14152 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14153 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14154 if (txdata_constr.datalen > 0)
14155 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14157 txdata_constr.data = NULL;
14158 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14159 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14160 int64_t txdata_conv_24 = txdata_vals[y];
14161 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14162 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14163 txdata_constr.data[y] = txdata_conv_24_conv;
14165 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14166 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14167 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14168 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14169 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14171 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14172 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14173 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14174 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14176 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14177 if (logger_conv.free == LDKLogger_JCalls_free) {
14178 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14179 LDKLogger_JCalls_clone(logger_conv.this_arg);
14181 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);
14182 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14183 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14184 for (size_t u = 0; u < ret_var.datalen; u++) {
14185 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14186 *ret_conv_46_ref = ret_var.data[u];
14187 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14189 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14190 FREE(ret_var.data);
14194 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) {
14195 LDKChannelMonitor this_arg_conv;
14196 this_arg_conv.inner = (void*)(this_arg & (~1));
14197 this_arg_conv.is_owned = false;
14198 unsigned char txid_arr[32];
14199 CHECK((*env)->GetArrayLength(env, txid) == 32);
14200 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14201 unsigned char (*txid_ref)[32] = &txid_arr;
14202 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14203 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14204 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14205 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14207 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14208 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14209 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14210 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14212 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14213 if (logger_conv.free == LDKLogger_JCalls_free) {
14214 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14215 LDKLogger_JCalls_clone(logger_conv.this_arg);
14217 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
14220 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) {
14221 LDKChannelMonitor this_arg_conv;
14222 this_arg_conv.inner = (void*)(this_arg & (~1));
14223 this_arg_conv.is_owned = false;
14224 unsigned char header_arr[80];
14225 CHECK((*env)->GetArrayLength(env, header) == 80);
14226 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14227 unsigned char (*header_ref)[80] = &header_arr;
14228 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14229 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14230 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14231 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14233 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14234 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14235 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14236 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14238 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14239 if (logger_conv.free == LDKLogger_JCalls_free) {
14240 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14241 LDKLogger_JCalls_clone(logger_conv.this_arg);
14243 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14244 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14245 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14246 for (size_t u = 0; u < ret_var.datalen; u++) {
14247 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14248 *ret_conv_46_ref = ret_var.data[u];
14249 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14251 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14252 FREE(ret_var.data);
14256 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
14257 LDKChannelMonitor this_arg_conv;
14258 this_arg_conv.inner = (void*)(this_arg & (~1));
14259 this_arg_conv.is_owned = false;
14260 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
14261 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14263 for (size_t i = 0; i < ret_var.datalen; i++) {
14264 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
14265 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
14266 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14268 FREE(ret_var.data);
14272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14273 if ((this_ptr & 1) != 0) return;
14274 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
14275 FREE((void*)this_ptr);
14276 Persist_free(this_ptr_conv);
14279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
14280 LDKu8slice ser_ref;
14281 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14282 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14283 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
14284 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14285 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
14286 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14287 return (uint64_t)ret_conv;
14290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14291 LDKOutPoint this_obj_conv;
14292 this_obj_conv.inner = (void*)(this_obj & (~1));
14293 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14294 OutPoint_free(this_obj_conv);
14297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
14298 LDKOutPoint this_ptr_conv;
14299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14300 this_ptr_conv.is_owned = false;
14301 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14302 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
14306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14307 LDKOutPoint this_ptr_conv;
14308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14309 this_ptr_conv.is_owned = false;
14310 LDKThirtyTwoBytes val_ref;
14311 CHECK((*env)->GetArrayLength(env, val) == 32);
14312 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14313 OutPoint_set_txid(&this_ptr_conv, val_ref);
14316 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
14317 LDKOutPoint this_ptr_conv;
14318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14319 this_ptr_conv.is_owned = false;
14320 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
14324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14325 LDKOutPoint this_ptr_conv;
14326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14327 this_ptr_conv.is_owned = false;
14328 OutPoint_set_index(&this_ptr_conv, val);
14331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
14332 LDKThirtyTwoBytes txid_arg_ref;
14333 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
14334 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
14335 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
14336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14338 uint64_t ret_ref = (uint64_t)ret_var.inner;
14339 if (ret_var.is_owned) {
14345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14346 LDKOutPoint orig_conv;
14347 orig_conv.inner = (void*)(orig & (~1));
14348 orig_conv.is_owned = false;
14349 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
14350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14352 uint64_t ret_ref = (uint64_t)ret_var.inner;
14353 if (ret_var.is_owned) {
14359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
14360 LDKOutPoint a_conv;
14361 a_conv.inner = (void*)(a & (~1));
14362 a_conv.is_owned = false;
14363 LDKOutPoint b_conv;
14364 b_conv.inner = (void*)(b & (~1));
14365 b_conv.is_owned = false;
14366 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
14370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
14371 LDKOutPoint o_conv;
14372 o_conv.inner = (void*)(o & (~1));
14373 o_conv.is_owned = false;
14374 int64_t ret_val = OutPoint_hash(&o_conv);
14378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14379 LDKOutPoint this_arg_conv;
14380 this_arg_conv.inner = (void*)(this_arg & (~1));
14381 this_arg_conv.is_owned = false;
14382 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14383 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
14387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
14388 LDKOutPoint obj_conv;
14389 obj_conv.inner = (void*)(obj & (~1));
14390 obj_conv.is_owned = false;
14391 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
14392 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14393 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14394 CVec_u8Z_free(ret_var);
14398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14399 LDKu8slice ser_ref;
14400 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14401 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14402 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14403 *ret_conv = OutPoint_read(ser_ref);
14404 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14405 return (uint64_t)ret_conv;
14408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14409 LDKDelayedPaymentOutputDescriptor this_obj_conv;
14410 this_obj_conv.inner = (void*)(this_obj & (~1));
14411 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14412 DelayedPaymentOutputDescriptor_free(this_obj_conv);
14415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14416 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14418 this_ptr_conv.is_owned = false;
14419 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14420 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14421 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14422 uint64_t ret_ref = (uint64_t)ret_var.inner;
14423 if (ret_var.is_owned) {
14429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14430 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14432 this_ptr_conv.is_owned = false;
14433 LDKOutPoint val_conv;
14434 val_conv.inner = (void*)(val & (~1));
14435 val_conv.is_owned = (val & 1) || (val == 0);
14436 val_conv = OutPoint_clone(&val_conv);
14437 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14441 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14443 this_ptr_conv.is_owned = false;
14444 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14445 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
14449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14450 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14452 this_ptr_conv.is_owned = false;
14453 LDKPublicKey val_ref;
14454 CHECK((*env)->GetArrayLength(env, val) == 33);
14455 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14456 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
14459 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14460 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14462 this_ptr_conv.is_owned = false;
14463 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
14467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14468 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14470 this_ptr_conv.is_owned = false;
14471 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
14474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14475 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14477 this_ptr_conv.is_owned = false;
14478 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14479 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14483 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14485 this_ptr_conv.is_owned = false;
14486 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14487 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
14491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14492 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14494 this_ptr_conv.is_owned = false;
14495 LDKPublicKey val_ref;
14496 CHECK((*env)->GetArrayLength(env, val) == 33);
14497 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14498 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
14501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14502 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14504 this_ptr_conv.is_owned = false;
14505 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14506 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14511 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14513 this_ptr_conv.is_owned = false;
14514 LDKThirtyTwoBytes val_ref;
14515 CHECK((*env)->GetArrayLength(env, val) == 32);
14516 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14517 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14521 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14523 this_ptr_conv.is_owned = false;
14524 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14529 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14531 this_ptr_conv.is_owned = false;
14532 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14535 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) {
14536 LDKOutPoint outpoint_arg_conv;
14537 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14538 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14539 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14540 LDKPublicKey per_commitment_point_arg_ref;
14541 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
14542 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14543 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14544 LDKPublicKey revocation_pubkey_arg_ref;
14545 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
14546 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
14547 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14548 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14549 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14550 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);
14551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14553 uint64_t ret_ref = (uint64_t)ret_var.inner;
14554 if (ret_var.is_owned) {
14560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14561 LDKDelayedPaymentOutputDescriptor orig_conv;
14562 orig_conv.inner = (void*)(orig & (~1));
14563 orig_conv.is_owned = false;
14564 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
14565 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14566 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14567 uint64_t ret_ref = (uint64_t)ret_var.inner;
14568 if (ret_var.is_owned) {
14574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14575 LDKDelayedPaymentOutputDescriptor obj_conv;
14576 obj_conv.inner = (void*)(obj & (~1));
14577 obj_conv.is_owned = false;
14578 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
14579 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14580 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14581 CVec_u8Z_free(ret_var);
14585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14586 LDKu8slice ser_ref;
14587 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14588 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14589 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14590 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
14591 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14592 return (uint64_t)ret_conv;
14595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14596 LDKStaticPaymentOutputDescriptor this_obj_conv;
14597 this_obj_conv.inner = (void*)(this_obj & (~1));
14598 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14599 StaticPaymentOutputDescriptor_free(this_obj_conv);
14602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14603 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14605 this_ptr_conv.is_owned = false;
14606 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14609 uint64_t ret_ref = (uint64_t)ret_var.inner;
14610 if (ret_var.is_owned) {
14616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14617 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14619 this_ptr_conv.is_owned = false;
14620 LDKOutPoint val_conv;
14621 val_conv.inner = (void*)(val & (~1));
14622 val_conv.is_owned = (val & 1) || (val == 0);
14623 val_conv = OutPoint_clone(&val_conv);
14624 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14628 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14630 this_ptr_conv.is_owned = false;
14631 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14632 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14636 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14638 this_ptr_conv.is_owned = false;
14639 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14640 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14645 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14647 this_ptr_conv.is_owned = false;
14648 LDKThirtyTwoBytes val_ref;
14649 CHECK((*env)->GetArrayLength(env, val) == 32);
14650 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14651 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14655 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14657 this_ptr_conv.is_owned = false;
14658 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14663 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14665 this_ptr_conv.is_owned = false;
14666 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14669 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) {
14670 LDKOutPoint outpoint_arg_conv;
14671 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14672 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14673 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14674 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14675 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14676 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14677 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14678 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
14679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14681 uint64_t ret_ref = (uint64_t)ret_var.inner;
14682 if (ret_var.is_owned) {
14688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14689 LDKStaticPaymentOutputDescriptor orig_conv;
14690 orig_conv.inner = (void*)(orig & (~1));
14691 orig_conv.is_owned = false;
14692 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
14693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14695 uint64_t ret_ref = (uint64_t)ret_var.inner;
14696 if (ret_var.is_owned) {
14702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14703 LDKStaticPaymentOutputDescriptor obj_conv;
14704 obj_conv.inner = (void*)(obj & (~1));
14705 obj_conv.is_owned = false;
14706 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
14707 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14708 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14709 CVec_u8Z_free(ret_var);
14713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14714 LDKu8slice ser_ref;
14715 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14716 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14717 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14718 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
14719 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14720 return (uint64_t)ret_conv;
14723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14724 if ((this_ptr & 1) != 0) return;
14725 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
14726 FREE((void*)this_ptr);
14727 SpendableOutputDescriptor_free(this_ptr_conv);
14730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14731 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
14732 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14733 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
14734 uint64_t ret_ref = (uint64_t)ret_copy;
14738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14739 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
14740 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
14741 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14742 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14743 CVec_u8Z_free(ret_var);
14747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14748 LDKu8slice ser_ref;
14749 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14750 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14751 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14752 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
14753 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14754 return (uint64_t)ret_conv;
14757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14758 if ((this_ptr & 1) != 0) return;
14759 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
14760 FREE((void*)this_ptr);
14761 BaseSign_free(this_ptr_conv);
14764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14765 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
14766 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
14767 *ret = Sign_clone(orig_conv);
14768 return (uint64_t)ret;
14771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14772 if ((this_ptr & 1) != 0) return;
14773 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
14774 FREE((void*)this_ptr);
14775 Sign_free(this_ptr_conv);
14778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14779 if ((this_ptr & 1) != 0) return;
14780 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
14781 FREE((void*)this_ptr);
14782 KeysInterface_free(this_ptr_conv);
14785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14786 LDKInMemorySigner this_obj_conv;
14787 this_obj_conv.inner = (void*)(this_obj & (~1));
14788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14789 InMemorySigner_free(this_obj_conv);
14792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14793 LDKInMemorySigner this_ptr_conv;
14794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14795 this_ptr_conv.is_owned = false;
14796 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14797 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
14801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14802 LDKInMemorySigner this_ptr_conv;
14803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14804 this_ptr_conv.is_owned = false;
14805 LDKSecretKey val_ref;
14806 CHECK((*env)->GetArrayLength(env, val) == 32);
14807 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14808 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
14811 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14812 LDKInMemorySigner this_ptr_conv;
14813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14814 this_ptr_conv.is_owned = false;
14815 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14816 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
14820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14821 LDKInMemorySigner this_ptr_conv;
14822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14823 this_ptr_conv.is_owned = false;
14824 LDKSecretKey val_ref;
14825 CHECK((*env)->GetArrayLength(env, val) == 32);
14826 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14827 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
14830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14831 LDKInMemorySigner this_ptr_conv;
14832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14833 this_ptr_conv.is_owned = false;
14834 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14835 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
14839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14840 LDKInMemorySigner this_ptr_conv;
14841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14842 this_ptr_conv.is_owned = false;
14843 LDKSecretKey val_ref;
14844 CHECK((*env)->GetArrayLength(env, val) == 32);
14845 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14846 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
14849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14850 LDKInMemorySigner this_ptr_conv;
14851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14852 this_ptr_conv.is_owned = false;
14853 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14854 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
14858 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) {
14859 LDKInMemorySigner this_ptr_conv;
14860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14861 this_ptr_conv.is_owned = false;
14862 LDKSecretKey val_ref;
14863 CHECK((*env)->GetArrayLength(env, val) == 32);
14864 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14865 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
14868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14869 LDKInMemorySigner this_ptr_conv;
14870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14871 this_ptr_conv.is_owned = false;
14872 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14873 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
14877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14878 LDKInMemorySigner this_ptr_conv;
14879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14880 this_ptr_conv.is_owned = false;
14881 LDKSecretKey val_ref;
14882 CHECK((*env)->GetArrayLength(env, val) == 32);
14883 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14884 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
14887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
14888 LDKInMemorySigner this_ptr_conv;
14889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14890 this_ptr_conv.is_owned = false;
14891 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14892 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
14896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14897 LDKInMemorySigner this_ptr_conv;
14898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14899 this_ptr_conv.is_owned = false;
14900 LDKThirtyTwoBytes val_ref;
14901 CHECK((*env)->GetArrayLength(env, val) == 32);
14902 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14903 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
14906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14907 LDKInMemorySigner orig_conv;
14908 orig_conv.inner = (void*)(orig & (~1));
14909 orig_conv.is_owned = false;
14910 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
14911 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14912 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14913 uint64_t ret_ref = (uint64_t)ret_var.inner;
14914 if (ret_var.is_owned) {
14920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
14921 LDKSecretKey funding_key_ref;
14922 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
14923 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
14924 LDKSecretKey revocation_base_key_ref;
14925 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
14926 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
14927 LDKSecretKey payment_key_ref;
14928 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
14929 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
14930 LDKSecretKey delayed_payment_base_key_ref;
14931 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
14932 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
14933 LDKSecretKey htlc_base_key_ref;
14934 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
14935 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
14936 LDKThirtyTwoBytes commitment_seed_ref;
14937 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
14938 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
14939 LDKThirtyTwoBytes channel_keys_id_ref;
14940 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
14941 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
14942 LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref);
14943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14945 uint64_t ret_ref = (uint64_t)ret_var.inner;
14946 if (ret_var.is_owned) {
14952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
14953 LDKInMemorySigner this_arg_conv;
14954 this_arg_conv.inner = (void*)(this_arg & (~1));
14955 this_arg_conv.is_owned = false;
14956 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
14957 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14958 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14959 uint64_t ret_ref = (uint64_t)ret_var.inner;
14960 if (ret_var.is_owned) {
14966 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
14967 LDKInMemorySigner this_arg_conv;
14968 this_arg_conv.inner = (void*)(this_arg & (~1));
14969 this_arg_conv.is_owned = false;
14970 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
14974 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
14975 LDKInMemorySigner this_arg_conv;
14976 this_arg_conv.inner = (void*)(this_arg & (~1));
14977 this_arg_conv.is_owned = false;
14978 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
14982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
14983 LDKInMemorySigner this_arg_conv;
14984 this_arg_conv.inner = (void*)(this_arg & (~1));
14985 this_arg_conv.is_owned = false;
14986 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
14990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
14991 LDKInMemorySigner this_arg_conv;
14992 this_arg_conv.inner = (void*)(this_arg & (~1));
14993 this_arg_conv.is_owned = false;
14994 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
14995 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14996 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14997 uint64_t ret_ref = (uint64_t)ret_var.inner;
14998 if (ret_var.is_owned) {
15004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
15005 LDKInMemorySigner this_arg_conv;
15006 this_arg_conv.inner = (void*)(this_arg & (~1));
15007 this_arg_conv.is_owned = false;
15008 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
15009 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15010 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15011 uint64_t ret_ref = (uint64_t)ret_var.inner;
15012 if (ret_var.is_owned) {
15018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
15019 LDKInMemorySigner this_arg_conv;
15020 this_arg_conv.inner = (void*)(this_arg & (~1));
15021 this_arg_conv.is_owned = false;
15022 LDKTransaction spend_tx_ref;
15023 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15024 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15025 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15026 spend_tx_ref.data_is_owned = true;
15027 LDKStaticPaymentOutputDescriptor descriptor_conv;
15028 descriptor_conv.inner = (void*)(descriptor & (~1));
15029 descriptor_conv.is_owned = false;
15030 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15031 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15032 return (uint64_t)ret_conv;
15035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic_1p2wsh_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
15036 LDKInMemorySigner this_arg_conv;
15037 this_arg_conv.inner = (void*)(this_arg & (~1));
15038 this_arg_conv.is_owned = false;
15039 LDKTransaction spend_tx_ref;
15040 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15041 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15042 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15043 spend_tx_ref.data_is_owned = true;
15044 LDKDelayedPaymentOutputDescriptor descriptor_conv;
15045 descriptor_conv.inner = (void*)(descriptor & (~1));
15046 descriptor_conv.is_owned = false;
15047 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15048 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15049 return (uint64_t)ret_conv;
15052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
15053 LDKInMemorySigner this_arg_conv;
15054 this_arg_conv.inner = (void*)(this_arg & (~1));
15055 this_arg_conv.is_owned = false;
15056 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
15057 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
15058 return (uint64_t)ret;
15061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
15062 LDKInMemorySigner this_arg_conv;
15063 this_arg_conv.inner = (void*)(this_arg & (~1));
15064 this_arg_conv.is_owned = false;
15065 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
15066 *ret = InMemorySigner_as_Sign(&this_arg_conv);
15067 return (uint64_t)ret;
15070 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
15071 LDKInMemorySigner obj_conv;
15072 obj_conv.inner = (void*)(obj & (~1));
15073 obj_conv.is_owned = false;
15074 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
15075 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15076 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15077 CVec_u8Z_free(ret_var);
15081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15082 LDKu8slice ser_ref;
15083 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15084 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15085 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15086 *ret_conv = InMemorySigner_read(ser_ref);
15087 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15088 return (uint64_t)ret_conv;
15091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15092 LDKKeysManager this_obj_conv;
15093 this_obj_conv.inner = (void*)(this_obj & (~1));
15094 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15095 KeysManager_free(this_obj_conv);
15098 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) {
15099 unsigned char seed_arr[32];
15100 CHECK((*env)->GetArrayLength(env, seed) == 32);
15101 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
15102 unsigned char (*seed_ref)[32] = &seed_arr;
15103 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
15104 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15105 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15106 uint64_t ret_ref = (uint64_t)ret_var.inner;
15107 if (ret_var.is_owned) {
15113 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) {
15114 LDKKeysManager this_arg_conv;
15115 this_arg_conv.inner = (void*)(this_arg & (~1));
15116 this_arg_conv.is_owned = false;
15117 unsigned char params_arr[32];
15118 CHECK((*env)->GetArrayLength(env, params) == 32);
15119 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
15120 unsigned char (*params_ref)[32] = ¶ms_arr;
15121 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
15122 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15123 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15124 uint64_t ret_ref = (uint64_t)ret_var.inner;
15125 if (ret_var.is_owned) {
15131 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) {
15132 LDKKeysManager this_arg_conv;
15133 this_arg_conv.inner = (void*)(this_arg & (~1));
15134 this_arg_conv.is_owned = false;
15135 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
15136 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
15137 if (descriptors_constr.datalen > 0)
15138 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15140 descriptors_constr.data = NULL;
15141 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
15142 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
15143 int64_t descriptors_conv_27 = descriptors_vals[b];
15144 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
15145 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
15146 descriptors_constr.data[b] = descriptors_conv_27_conv;
15148 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
15149 LDKCVec_TxOutZ outputs_constr;
15150 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
15151 if (outputs_constr.datalen > 0)
15152 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15154 outputs_constr.data = NULL;
15155 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
15156 for (size_t h = 0; h < outputs_constr.datalen; h++) {
15157 int64_t outputs_conv_7 = outputs_vals[h];
15158 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
15159 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
15160 outputs_constr.data[h] = outputs_conv_7_conv;
15162 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
15163 LDKCVec_u8Z change_destination_script_ref;
15164 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
15165 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
15166 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
15167 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15168 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
15169 return (uint64_t)ret_conv;
15172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
15173 LDKKeysManager this_arg_conv;
15174 this_arg_conv.inner = (void*)(this_arg & (~1));
15175 this_arg_conv.is_owned = false;
15176 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
15177 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
15178 return (uint64_t)ret;
15181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15182 LDKChannelManager this_obj_conv;
15183 this_obj_conv.inner = (void*)(this_obj & (~1));
15184 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15185 ChannelManager_free(this_obj_conv);
15188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15189 LDKChainParameters this_obj_conv;
15190 this_obj_conv.inner = (void*)(this_obj & (~1));
15191 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15192 ChainParameters_free(this_obj_conv);
15195 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
15196 LDKChainParameters this_ptr_conv;
15197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15198 this_ptr_conv.is_owned = false;
15199 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
15203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
15204 LDKChainParameters this_ptr_conv;
15205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15206 this_ptr_conv.is_owned = false;
15207 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
15208 ChainParameters_set_network(&this_ptr_conv, val_conv);
15211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
15212 LDKChainParameters this_ptr_conv;
15213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15214 this_ptr_conv.is_owned = false;
15215 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
15216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15218 uint64_t ret_ref = (uint64_t)ret_var.inner;
15219 if (ret_var.is_owned) {
15225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15226 LDKChainParameters this_ptr_conv;
15227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15228 this_ptr_conv.is_owned = false;
15229 LDKBestBlock val_conv;
15230 val_conv.inner = (void*)(val & (~1));
15231 val_conv.is_owned = (val & 1) || (val == 0);
15232 val_conv = BestBlock_clone(&val_conv);
15233 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
15236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
15237 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
15238 LDKBestBlock best_block_arg_conv;
15239 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
15240 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
15241 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
15242 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
15243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15245 uint64_t ret_ref = (uint64_t)ret_var.inner;
15246 if (ret_var.is_owned) {
15252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15253 LDKChainParameters orig_conv;
15254 orig_conv.inner = (void*)(orig & (~1));
15255 orig_conv.is_owned = false;
15256 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
15257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15259 uint64_t ret_ref = (uint64_t)ret_var.inner;
15260 if (ret_var.is_owned) {
15266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15267 LDKBestBlock this_obj_conv;
15268 this_obj_conv.inner = (void*)(this_obj & (~1));
15269 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15270 BestBlock_free(this_obj_conv);
15273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15274 LDKBestBlock orig_conv;
15275 orig_conv.inner = (void*)(orig & (~1));
15276 orig_conv.is_owned = false;
15277 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
15278 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15279 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15280 uint64_t ret_ref = (uint64_t)ret_var.inner;
15281 if (ret_var.is_owned) {
15287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
15288 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
15289 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
15290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15292 uint64_t ret_ref = (uint64_t)ret_var.inner;
15293 if (ret_var.is_owned) {
15299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
15300 LDKThirtyTwoBytes block_hash_ref;
15301 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
15302 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
15303 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
15304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15306 uint64_t ret_ref = (uint64_t)ret_var.inner;
15307 if (ret_var.is_owned) {
15313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
15314 LDKBestBlock this_arg_conv;
15315 this_arg_conv.inner = (void*)(this_arg & (~1));
15316 this_arg_conv.is_owned = false;
15317 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15318 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
15322 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
15323 LDKBestBlock this_arg_conv;
15324 this_arg_conv.inner = (void*)(this_arg & (~1));
15325 this_arg_conv.is_owned = false;
15326 int32_t ret_val = BestBlock_height(&this_arg_conv);
15330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15331 LDKChannelDetails this_obj_conv;
15332 this_obj_conv.inner = (void*)(this_obj & (~1));
15333 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15334 ChannelDetails_free(this_obj_conv);
15337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15338 LDKChannelDetails this_ptr_conv;
15339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15340 this_ptr_conv.is_owned = false;
15341 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15342 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
15346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15347 LDKChannelDetails this_ptr_conv;
15348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15349 this_ptr_conv.is_owned = false;
15350 LDKThirtyTwoBytes val_ref;
15351 CHECK((*env)->GetArrayLength(env, val) == 32);
15352 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15353 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
15356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
15357 LDKChannelDetails this_ptr_conv;
15358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15359 this_ptr_conv.is_owned = false;
15360 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
15361 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15362 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15363 uint64_t ret_ref = (uint64_t)ret_var.inner;
15364 if (ret_var.is_owned) {
15370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15371 LDKChannelDetails this_ptr_conv;
15372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15373 this_ptr_conv.is_owned = false;
15374 LDKOutPoint val_conv;
15375 val_conv.inner = (void*)(val & (~1));
15376 val_conv.is_owned = (val & 1) || (val == 0);
15377 val_conv = OutPoint_clone(&val_conv);
15378 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
15381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15382 LDKChannelDetails this_ptr_conv;
15383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15384 this_ptr_conv.is_owned = false;
15385 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15386 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
15387 uint64_t ret_ref = (uint64_t)ret_copy;
15391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15392 LDKChannelDetails this_ptr_conv;
15393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15394 this_ptr_conv.is_owned = false;
15395 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15396 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
15399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15400 LDKChannelDetails this_ptr_conv;
15401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15402 this_ptr_conv.is_owned = false;
15403 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15404 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
15408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15409 LDKChannelDetails this_ptr_conv;
15410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15411 this_ptr_conv.is_owned = false;
15412 LDKPublicKey val_ref;
15413 CHECK((*env)->GetArrayLength(env, val) == 33);
15414 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15415 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
15418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15419 LDKChannelDetails this_ptr_conv;
15420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15421 this_ptr_conv.is_owned = false;
15422 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
15423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15425 uint64_t ret_ref = (uint64_t)ret_var.inner;
15426 if (ret_var.is_owned) {
15432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15433 LDKChannelDetails this_ptr_conv;
15434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15435 this_ptr_conv.is_owned = false;
15436 LDKInitFeatures val_conv;
15437 val_conv.inner = (void*)(val & (~1));
15438 val_conv.is_owned = (val & 1) || (val == 0);
15439 val_conv = InitFeatures_clone(&val_conv);
15440 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
15443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15444 LDKChannelDetails this_ptr_conv;
15445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15446 this_ptr_conv.is_owned = false;
15447 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
15451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15452 LDKChannelDetails this_ptr_conv;
15453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15454 this_ptr_conv.is_owned = false;
15455 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
15458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15459 LDKChannelDetails this_ptr_conv;
15460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15461 this_ptr_conv.is_owned = false;
15462 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
15466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15467 LDKChannelDetails this_ptr_conv;
15468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15469 this_ptr_conv.is_owned = false;
15470 ChannelDetails_set_user_id(&this_ptr_conv, val);
15473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15474 LDKChannelDetails this_ptr_conv;
15475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15476 this_ptr_conv.is_owned = false;
15477 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
15481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15482 LDKChannelDetails this_ptr_conv;
15483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15484 this_ptr_conv.is_owned = false;
15485 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
15488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15489 LDKChannelDetails this_ptr_conv;
15490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15491 this_ptr_conv.is_owned = false;
15492 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
15496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15497 LDKChannelDetails this_ptr_conv;
15498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15499 this_ptr_conv.is_owned = false;
15500 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
15503 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
15504 LDKChannelDetails this_ptr_conv;
15505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15506 this_ptr_conv.is_owned = false;
15507 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
15511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15512 LDKChannelDetails this_ptr_conv;
15513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15514 this_ptr_conv.is_owned = false;
15515 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
15518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
15519 LDKChannelDetails this_ptr_conv;
15520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15521 this_ptr_conv.is_owned = false;
15522 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
15526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15527 LDKChannelDetails this_ptr_conv;
15528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15529 this_ptr_conv.is_owned = false;
15530 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
15533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
15534 LDKChannelDetails this_ptr_conv;
15535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15536 this_ptr_conv.is_owned = false;
15537 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
15541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15542 LDKChannelDetails this_ptr_conv;
15543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15544 this_ptr_conv.is_owned = false;
15545 ChannelDetails_set_is_usable(&this_ptr_conv, val);
15548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
15549 LDKChannelDetails this_ptr_conv;
15550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15551 this_ptr_conv.is_owned = false;
15552 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
15556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15557 LDKChannelDetails this_ptr_conv;
15558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15559 this_ptr_conv.is_owned = false;
15560 ChannelDetails_set_is_public(&this_ptr_conv, val);
15563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15564 LDKChannelDetails orig_conv;
15565 orig_conv.inner = (void*)(orig & (~1));
15566 orig_conv.is_owned = false;
15567 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
15568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15570 uint64_t ret_ref = (uint64_t)ret_var.inner;
15571 if (ret_var.is_owned) {
15577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15578 if ((this_ptr & 1) != 0) return;
15579 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
15580 FREE((void*)this_ptr);
15581 PaymentSendFailure_free(this_ptr_conv);
15584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15585 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
15586 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15587 *ret_copy = PaymentSendFailure_clone(orig_conv);
15588 uint64_t ret_ref = (uint64_t)ret_copy;
15592 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) {
15593 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
15594 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
15595 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15596 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
15598 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
15599 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
15600 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15601 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
15603 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
15604 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15605 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15606 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
15608 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15609 if (logger_conv.free == LDKLogger_JCalls_free) {
15610 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15611 LDKLogger_JCalls_clone(logger_conv.this_arg);
15613 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
15614 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
15615 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15616 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
15618 LDKUserConfig config_conv;
15619 config_conv.inner = (void*)(config & (~1));
15620 config_conv.is_owned = (config & 1) || (config == 0);
15621 config_conv = UserConfig_clone(&config_conv);
15622 LDKChainParameters params_conv;
15623 params_conv.inner = (void*)(params & (~1));
15624 params_conv.is_owned = (params & 1) || (params == 0);
15625 params_conv = ChainParameters_clone(¶ms_conv);
15626 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
15627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15629 uint64_t ret_ref = (uint64_t)ret_var.inner;
15630 if (ret_var.is_owned) {
15636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
15637 LDKChannelManager this_arg_conv;
15638 this_arg_conv.inner = (void*)(this_arg & (~1));
15639 this_arg_conv.is_owned = false;
15640 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
15641 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15642 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15643 uint64_t ret_ref = (uint64_t)ret_var.inner;
15644 if (ret_var.is_owned) {
15650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, int64_t override_config) {
15651 LDKChannelManager this_arg_conv;
15652 this_arg_conv.inner = (void*)(this_arg & (~1));
15653 this_arg_conv.is_owned = false;
15654 LDKPublicKey their_network_key_ref;
15655 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
15656 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
15657 LDKUserConfig override_config_conv;
15658 override_config_conv.inner = (void*)(override_config & (~1));
15659 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
15660 override_config_conv = UserConfig_clone(&override_config_conv);
15661 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15662 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
15663 return (uint64_t)ret_conv;
15666 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15667 LDKChannelManager this_arg_conv;
15668 this_arg_conv.inner = (void*)(this_arg & (~1));
15669 this_arg_conv.is_owned = false;
15670 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
15671 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15672 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15673 for (size_t q = 0; q < ret_var.datalen; q++) {
15674 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15675 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15676 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15677 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15678 if (ret_conv_16_var.is_owned) {
15679 ret_conv_16_ref |= 1;
15681 ret_arr_ptr[q] = ret_conv_16_ref;
15683 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15684 FREE(ret_var.data);
15688 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15689 LDKChannelManager this_arg_conv;
15690 this_arg_conv.inner = (void*)(this_arg & (~1));
15691 this_arg_conv.is_owned = false;
15692 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
15693 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15694 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15695 for (size_t q = 0; q < ret_var.datalen; q++) {
15696 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15697 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15698 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15699 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15700 if (ret_conv_16_var.is_owned) {
15701 ret_conv_16_ref |= 1;
15703 ret_arr_ptr[q] = ret_conv_16_ref;
15705 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15706 FREE(ret_var.data);
15710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
15711 LDKChannelManager this_arg_conv;
15712 this_arg_conv.inner = (void*)(this_arg & (~1));
15713 this_arg_conv.is_owned = false;
15714 unsigned char channel_id_arr[32];
15715 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15716 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
15717 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15718 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15719 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
15720 return (uint64_t)ret_conv;
15723 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) {
15724 LDKChannelManager this_arg_conv;
15725 this_arg_conv.inner = (void*)(this_arg & (~1));
15726 this_arg_conv.is_owned = false;
15727 unsigned char channel_id_arr[32];
15728 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15729 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
15730 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15731 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15732 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
15733 return (uint64_t)ret_conv;
15736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15737 LDKChannelManager this_arg_conv;
15738 this_arg_conv.inner = (void*)(this_arg & (~1));
15739 this_arg_conv.is_owned = false;
15740 ChannelManager_force_close_all_channels(&this_arg_conv);
15743 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) {
15744 LDKChannelManager this_arg_conv;
15745 this_arg_conv.inner = (void*)(this_arg & (~1));
15746 this_arg_conv.is_owned = false;
15747 LDKRoute route_conv;
15748 route_conv.inner = (void*)(route & (~1));
15749 route_conv.is_owned = false;
15750 LDKThirtyTwoBytes payment_hash_ref;
15751 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15752 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15753 LDKThirtyTwoBytes payment_secret_ref;
15754 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
15755 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
15756 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15757 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
15758 return (uint64_t)ret_conv;
15761 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) {
15762 LDKChannelManager this_arg_conv;
15763 this_arg_conv.inner = (void*)(this_arg & (~1));
15764 this_arg_conv.is_owned = false;
15765 unsigned char temporary_channel_id_arr[32];
15766 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
15767 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
15768 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
15769 LDKTransaction funding_transaction_ref;
15770 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
15771 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
15772 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
15773 funding_transaction_ref.data_is_owned = true;
15774 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15775 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
15776 return (uint64_t)ret_conv;
15779 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) {
15780 LDKChannelManager this_arg_conv;
15781 this_arg_conv.inner = (void*)(this_arg & (~1));
15782 this_arg_conv.is_owned = false;
15783 LDKThreeBytes rgb_ref;
15784 CHECK((*env)->GetArrayLength(env, rgb) == 3);
15785 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
15786 LDKThirtyTwoBytes alias_ref;
15787 CHECK((*env)->GetArrayLength(env, alias) == 32);
15788 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
15789 LDKCVec_NetAddressZ addresses_constr;
15790 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
15791 if (addresses_constr.datalen > 0)
15792 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15794 addresses_constr.data = NULL;
15795 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
15796 for (size_t m = 0; m < addresses_constr.datalen; m++) {
15797 int64_t addresses_conv_12 = addresses_vals[m];
15798 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
15799 addresses_constr.data[m] = addresses_conv_12_conv;
15801 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
15802 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
15805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
15806 LDKChannelManager this_arg_conv;
15807 this_arg_conv.inner = (void*)(this_arg & (~1));
15808 this_arg_conv.is_owned = false;
15809 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
15812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
15813 LDKChannelManager this_arg_conv;
15814 this_arg_conv.inner = (void*)(this_arg & (~1));
15815 this_arg_conv.is_owned = false;
15816 ChannelManager_timer_tick_occurred(&this_arg_conv);
15819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
15820 LDKChannelManager this_arg_conv;
15821 this_arg_conv.inner = (void*)(this_arg & (~1));
15822 this_arg_conv.is_owned = false;
15823 unsigned char payment_hash_arr[32];
15824 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15825 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
15826 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
15827 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
15831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
15832 LDKChannelManager this_arg_conv;
15833 this_arg_conv.inner = (void*)(this_arg & (~1));
15834 this_arg_conv.is_owned = false;
15835 LDKThirtyTwoBytes payment_preimage_ref;
15836 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
15837 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
15838 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
15842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
15843 LDKChannelManager this_arg_conv;
15844 this_arg_conv.inner = (void*)(this_arg & (~1));
15845 this_arg_conv.is_owned = false;
15846 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15847 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
15851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t highest_applied_update_id) {
15852 LDKChannelManager this_arg_conv;
15853 this_arg_conv.inner = (void*)(this_arg & (~1));
15854 this_arg_conv.is_owned = false;
15855 LDKOutPoint funding_txo_conv;
15856 funding_txo_conv.inner = (void*)(funding_txo & (~1));
15857 funding_txo_conv.is_owned = false;
15858 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
15861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) {
15862 LDKChannelManager this_arg_conv;
15863 this_arg_conv.inner = (void*)(this_arg & (~1));
15864 this_arg_conv.is_owned = false;
15865 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15866 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15867 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
15868 return (uint64_t)ret_ref;
15871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) {
15872 LDKChannelManager this_arg_conv;
15873 this_arg_conv.inner = (void*)(this_arg & (~1));
15874 this_arg_conv.is_owned = false;
15875 LDKThirtyTwoBytes payment_hash_ref;
15876 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15877 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15878 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15879 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15880 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
15881 return (uint64_t)ret_conv;
15884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
15885 LDKChannelManager this_arg_conv;
15886 this_arg_conv.inner = (void*)(this_arg & (~1));
15887 this_arg_conv.is_owned = false;
15888 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15889 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
15890 return (uint64_t)ret;
15893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
15894 LDKChannelManager this_arg_conv;
15895 this_arg_conv.inner = (void*)(this_arg & (~1));
15896 this_arg_conv.is_owned = false;
15897 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15898 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
15899 return (uint64_t)ret;
15902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
15903 LDKChannelManager this_arg_conv;
15904 this_arg_conv.inner = (void*)(this_arg & (~1));
15905 this_arg_conv.is_owned = false;
15906 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
15907 *ret = ChannelManager_as_Listen(&this_arg_conv);
15908 return (uint64_t)ret;
15911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
15912 LDKChannelManager this_arg_conv;
15913 this_arg_conv.inner = (void*)(this_arg & (~1));
15914 this_arg_conv.is_owned = false;
15915 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15916 *ret = ChannelManager_as_Confirm(&this_arg_conv);
15917 return (uint64_t)ret;
15920 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) {
15921 LDKChannelManager this_arg_conv;
15922 this_arg_conv.inner = (void*)(this_arg & (~1));
15923 this_arg_conv.is_owned = false;
15924 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
15928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
15929 LDKChannelManager this_arg_conv;
15930 this_arg_conv.inner = (void*)(this_arg & (~1));
15931 this_arg_conv.is_owned = false;
15932 ChannelManager_await_persistable_update(&this_arg_conv);
15935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
15936 LDKChannelManager this_arg_conv;
15937 this_arg_conv.inner = (void*)(this_arg & (~1));
15938 this_arg_conv.is_owned = false;
15939 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15940 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
15941 return (uint64_t)ret;
15944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
15945 LDKChannelManager obj_conv;
15946 obj_conv.inner = (void*)(obj & (~1));
15947 obj_conv.is_owned = false;
15948 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
15949 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15950 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15951 CVec_u8Z_free(ret_var);
15955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15956 LDKChannelManagerReadArgs this_obj_conv;
15957 this_obj_conv.inner = (void*)(this_obj & (~1));
15958 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15959 ChannelManagerReadArgs_free(this_obj_conv);
15962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
15963 LDKChannelManagerReadArgs this_ptr_conv;
15964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15965 this_ptr_conv.is_owned = false;
15966 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
15970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15971 LDKChannelManagerReadArgs this_ptr_conv;
15972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15973 this_ptr_conv.is_owned = false;
15974 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
15975 if (val_conv.free == LDKKeysInterface_JCalls_free) {
15976 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15977 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
15979 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
15982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
15983 LDKChannelManagerReadArgs this_ptr_conv;
15984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15985 this_ptr_conv.is_owned = false;
15986 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
15990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15991 LDKChannelManagerReadArgs this_ptr_conv;
15992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15993 this_ptr_conv.is_owned = false;
15994 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
15995 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
15996 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15997 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
15999 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
16002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
16003 LDKChannelManagerReadArgs this_ptr_conv;
16004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16005 this_ptr_conv.is_owned = false;
16006 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
16010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16011 LDKChannelManagerReadArgs this_ptr_conv;
16012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16013 this_ptr_conv.is_owned = false;
16014 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
16015 if (val_conv.free == LDKWatch_JCalls_free) {
16016 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16017 LDKWatch_JCalls_clone(val_conv.this_arg);
16019 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
16022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
16023 LDKChannelManagerReadArgs this_ptr_conv;
16024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16025 this_ptr_conv.is_owned = false;
16026 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
16030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16031 LDKChannelManagerReadArgs this_ptr_conv;
16032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16033 this_ptr_conv.is_owned = false;
16034 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
16035 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
16036 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16037 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
16039 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
16042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
16043 LDKChannelManagerReadArgs this_ptr_conv;
16044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16045 this_ptr_conv.is_owned = false;
16046 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
16050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16051 LDKChannelManagerReadArgs this_ptr_conv;
16052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16053 this_ptr_conv.is_owned = false;
16054 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
16055 if (val_conv.free == LDKLogger_JCalls_free) {
16056 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16057 LDKLogger_JCalls_clone(val_conv.this_arg);
16059 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
16062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
16063 LDKChannelManagerReadArgs this_ptr_conv;
16064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16065 this_ptr_conv.is_owned = false;
16066 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
16067 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16068 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16069 uint64_t ret_ref = (uint64_t)ret_var.inner;
16070 if (ret_var.is_owned) {
16076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16077 LDKChannelManagerReadArgs this_ptr_conv;
16078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16079 this_ptr_conv.is_owned = false;
16080 LDKUserConfig val_conv;
16081 val_conv.inner = (void*)(val & (~1));
16082 val_conv.is_owned = (val & 1) || (val == 0);
16083 val_conv = UserConfig_clone(&val_conv);
16084 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16087 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) {
16088 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16089 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
16090 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16091 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
16093 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16094 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16095 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16096 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
16098 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16099 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
16100 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16101 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
16103 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16104 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16105 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16106 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
16108 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16109 if (logger_conv.free == LDKLogger_JCalls_free) {
16110 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16111 LDKLogger_JCalls_clone(logger_conv.this_arg);
16113 LDKUserConfig default_config_conv;
16114 default_config_conv.inner = (void*)(default_config & (~1));
16115 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16116 default_config_conv = UserConfig_clone(&default_config_conv);
16117 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16118 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
16119 if (channel_monitors_constr.datalen > 0)
16120 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16122 channel_monitors_constr.data = NULL;
16123 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
16124 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16125 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
16126 LDKChannelMonitor channel_monitors_conv_16_conv;
16127 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16128 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16129 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16131 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
16132 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);
16133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16135 uint64_t ret_ref = (uint64_t)ret_var.inner;
16136 if (ret_var.is_owned) {
16142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
16143 LDKu8slice ser_ref;
16144 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16145 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16146 LDKChannelManagerReadArgs arg_conv;
16147 arg_conv.inner = (void*)(arg & (~1));
16148 arg_conv.is_owned = (arg & 1) || (arg == 0);
16149 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16150 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16151 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16152 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16153 return (uint64_t)ret_conv;
16156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16157 LDKDecodeError this_obj_conv;
16158 this_obj_conv.inner = (void*)(this_obj & (~1));
16159 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16160 DecodeError_free(this_obj_conv);
16163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16164 LDKDecodeError orig_conv;
16165 orig_conv.inner = (void*)(orig & (~1));
16166 orig_conv.is_owned = false;
16167 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16170 uint64_t ret_ref = (uint64_t)ret_var.inner;
16171 if (ret_var.is_owned) {
16177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16178 LDKInit this_obj_conv;
16179 this_obj_conv.inner = (void*)(this_obj & (~1));
16180 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16181 Init_free(this_obj_conv);
16184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16185 LDKInit this_ptr_conv;
16186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16187 this_ptr_conv.is_owned = false;
16188 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
16189 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16190 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16191 uint64_t ret_ref = (uint64_t)ret_var.inner;
16192 if (ret_var.is_owned) {
16198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16199 LDKInit this_ptr_conv;
16200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16201 this_ptr_conv.is_owned = false;
16202 LDKInitFeatures val_conv;
16203 val_conv.inner = (void*)(val & (~1));
16204 val_conv.is_owned = (val & 1) || (val == 0);
16205 val_conv = InitFeatures_clone(&val_conv);
16206 Init_set_features(&this_ptr_conv, val_conv);
16209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
16210 LDKInitFeatures features_arg_conv;
16211 features_arg_conv.inner = (void*)(features_arg & (~1));
16212 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16213 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16214 LDKInit ret_var = Init_new(features_arg_conv);
16215 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16216 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16217 uint64_t ret_ref = (uint64_t)ret_var.inner;
16218 if (ret_var.is_owned) {
16224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16226 orig_conv.inner = (void*)(orig & (~1));
16227 orig_conv.is_owned = false;
16228 LDKInit ret_var = Init_clone(&orig_conv);
16229 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16230 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16231 uint64_t ret_ref = (uint64_t)ret_var.inner;
16232 if (ret_var.is_owned) {
16238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16239 LDKErrorMessage this_obj_conv;
16240 this_obj_conv.inner = (void*)(this_obj & (~1));
16241 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16242 ErrorMessage_free(this_obj_conv);
16245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16246 LDKErrorMessage this_ptr_conv;
16247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16248 this_ptr_conv.is_owned = false;
16249 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16250 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
16254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16255 LDKErrorMessage this_ptr_conv;
16256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16257 this_ptr_conv.is_owned = false;
16258 LDKThirtyTwoBytes val_ref;
16259 CHECK((*env)->GetArrayLength(env, val) == 32);
16260 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16261 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
16264 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
16265 LDKErrorMessage this_ptr_conv;
16266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16267 this_ptr_conv.is_owned = false;
16268 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
16269 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
16273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
16274 LDKErrorMessage this_ptr_conv;
16275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16276 this_ptr_conv.is_owned = false;
16277 LDKStr val_conv = java_to_owned_str(env, val);
16278 ErrorMessage_set_data(&this_ptr_conv, val_conv);
16281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
16282 LDKThirtyTwoBytes channel_id_arg_ref;
16283 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
16284 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
16285 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
16286 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
16287 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16288 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16289 uint64_t ret_ref = (uint64_t)ret_var.inner;
16290 if (ret_var.is_owned) {
16296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16297 LDKErrorMessage orig_conv;
16298 orig_conv.inner = (void*)(orig & (~1));
16299 orig_conv.is_owned = false;
16300 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
16301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16303 uint64_t ret_ref = (uint64_t)ret_var.inner;
16304 if (ret_var.is_owned) {
16310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16311 LDKPing this_obj_conv;
16312 this_obj_conv.inner = (void*)(this_obj & (~1));
16313 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16314 Ping_free(this_obj_conv);
16317 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16318 LDKPing this_ptr_conv;
16319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16320 this_ptr_conv.is_owned = false;
16321 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
16325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16326 LDKPing this_ptr_conv;
16327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16328 this_ptr_conv.is_owned = false;
16329 Ping_set_ponglen(&this_ptr_conv, val);
16332 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16333 LDKPing this_ptr_conv;
16334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16335 this_ptr_conv.is_owned = false;
16336 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
16340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16341 LDKPing this_ptr_conv;
16342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16343 this_ptr_conv.is_owned = false;
16344 Ping_set_byteslen(&this_ptr_conv, val);
16347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
16348 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
16349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16351 uint64_t ret_ref = (uint64_t)ret_var.inner;
16352 if (ret_var.is_owned) {
16358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16360 orig_conv.inner = (void*)(orig & (~1));
16361 orig_conv.is_owned = false;
16362 LDKPing ret_var = Ping_clone(&orig_conv);
16363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16365 uint64_t ret_ref = (uint64_t)ret_var.inner;
16366 if (ret_var.is_owned) {
16372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16373 LDKPong this_obj_conv;
16374 this_obj_conv.inner = (void*)(this_obj & (~1));
16375 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16376 Pong_free(this_obj_conv);
16379 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16380 LDKPong this_ptr_conv;
16381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16382 this_ptr_conv.is_owned = false;
16383 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
16387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16388 LDKPong this_ptr_conv;
16389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16390 this_ptr_conv.is_owned = false;
16391 Pong_set_byteslen(&this_ptr_conv, val);
16394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
16395 LDKPong ret_var = Pong_new(byteslen_arg);
16396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16398 uint64_t ret_ref = (uint64_t)ret_var.inner;
16399 if (ret_var.is_owned) {
16405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16407 orig_conv.inner = (void*)(orig & (~1));
16408 orig_conv.is_owned = false;
16409 LDKPong ret_var = Pong_clone(&orig_conv);
16410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16412 uint64_t ret_ref = (uint64_t)ret_var.inner;
16413 if (ret_var.is_owned) {
16419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16420 LDKOpenChannel this_obj_conv;
16421 this_obj_conv.inner = (void*)(this_obj & (~1));
16422 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16423 OpenChannel_free(this_obj_conv);
16426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16427 LDKOpenChannel this_ptr_conv;
16428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16429 this_ptr_conv.is_owned = false;
16430 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16431 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
16435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16436 LDKOpenChannel this_ptr_conv;
16437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16438 this_ptr_conv.is_owned = false;
16439 LDKThirtyTwoBytes val_ref;
16440 CHECK((*env)->GetArrayLength(env, val) == 32);
16441 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16442 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
16445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16446 LDKOpenChannel this_ptr_conv;
16447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16448 this_ptr_conv.is_owned = false;
16449 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16450 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
16454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16455 LDKOpenChannel this_ptr_conv;
16456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16457 this_ptr_conv.is_owned = false;
16458 LDKThirtyTwoBytes val_ref;
16459 CHECK((*env)->GetArrayLength(env, val) == 32);
16460 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16461 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16465 LDKOpenChannel this_ptr_conv;
16466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16467 this_ptr_conv.is_owned = false;
16468 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
16472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16473 LDKOpenChannel this_ptr_conv;
16474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16475 this_ptr_conv.is_owned = false;
16476 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
16479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16480 LDKOpenChannel this_ptr_conv;
16481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16482 this_ptr_conv.is_owned = false;
16483 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
16487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16488 LDKOpenChannel this_ptr_conv;
16489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16490 this_ptr_conv.is_owned = false;
16491 OpenChannel_set_push_msat(&this_ptr_conv, val);
16494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16495 LDKOpenChannel this_ptr_conv;
16496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16497 this_ptr_conv.is_owned = false;
16498 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
16502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16503 LDKOpenChannel this_ptr_conv;
16504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16505 this_ptr_conv.is_owned = false;
16506 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16509 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) {
16510 LDKOpenChannel this_ptr_conv;
16511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16512 this_ptr_conv.is_owned = false;
16513 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16517 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) {
16518 LDKOpenChannel this_ptr_conv;
16519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16520 this_ptr_conv.is_owned = false;
16521 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16525 LDKOpenChannel this_ptr_conv;
16526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16527 this_ptr_conv.is_owned = false;
16528 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16533 LDKOpenChannel this_ptr_conv;
16534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16535 this_ptr_conv.is_owned = false;
16536 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16540 LDKOpenChannel this_ptr_conv;
16541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16542 this_ptr_conv.is_owned = false;
16543 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
16547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16548 LDKOpenChannel this_ptr_conv;
16549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16550 this_ptr_conv.is_owned = false;
16551 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16554 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
16555 LDKOpenChannel this_ptr_conv;
16556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16557 this_ptr_conv.is_owned = false;
16558 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
16562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16563 LDKOpenChannel this_ptr_conv;
16564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16565 this_ptr_conv.is_owned = false;
16566 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
16569 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16570 LDKOpenChannel this_ptr_conv;
16571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16572 this_ptr_conv.is_owned = false;
16573 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
16577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16578 LDKOpenChannel this_ptr_conv;
16579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16580 this_ptr_conv.is_owned = false;
16581 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
16584 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16585 LDKOpenChannel this_ptr_conv;
16586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16587 this_ptr_conv.is_owned = false;
16588 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
16592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16593 LDKOpenChannel this_ptr_conv;
16594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16595 this_ptr_conv.is_owned = false;
16596 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16600 LDKOpenChannel this_ptr_conv;
16601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16602 this_ptr_conv.is_owned = false;
16603 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16604 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
16608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16609 LDKOpenChannel this_ptr_conv;
16610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16611 this_ptr_conv.is_owned = false;
16612 LDKPublicKey val_ref;
16613 CHECK((*env)->GetArrayLength(env, val) == 33);
16614 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16615 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16619 LDKOpenChannel this_ptr_conv;
16620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16621 this_ptr_conv.is_owned = false;
16622 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16623 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16628 LDKOpenChannel this_ptr_conv;
16629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16630 this_ptr_conv.is_owned = false;
16631 LDKPublicKey val_ref;
16632 CHECK((*env)->GetArrayLength(env, val) == 33);
16633 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16634 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16638 LDKOpenChannel this_ptr_conv;
16639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16640 this_ptr_conv.is_owned = false;
16641 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16642 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
16646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16647 LDKOpenChannel this_ptr_conv;
16648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16649 this_ptr_conv.is_owned = false;
16650 LDKPublicKey val_ref;
16651 CHECK((*env)->GetArrayLength(env, val) == 33);
16652 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16653 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
16656 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16657 LDKOpenChannel this_ptr_conv;
16658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16659 this_ptr_conv.is_owned = false;
16660 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16661 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16666 LDKOpenChannel this_ptr_conv;
16667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16668 this_ptr_conv.is_owned = false;
16669 LDKPublicKey val_ref;
16670 CHECK((*env)->GetArrayLength(env, val) == 33);
16671 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16672 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16676 LDKOpenChannel this_ptr_conv;
16677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16678 this_ptr_conv.is_owned = false;
16679 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16680 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16685 LDKOpenChannel this_ptr_conv;
16686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16687 this_ptr_conv.is_owned = false;
16688 LDKPublicKey val_ref;
16689 CHECK((*env)->GetArrayLength(env, val) == 33);
16690 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16691 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16695 LDKOpenChannel this_ptr_conv;
16696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16697 this_ptr_conv.is_owned = false;
16698 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16699 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
16703 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) {
16704 LDKOpenChannel this_ptr_conv;
16705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16706 this_ptr_conv.is_owned = false;
16707 LDKPublicKey val_ref;
16708 CHECK((*env)->GetArrayLength(env, val) == 33);
16709 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16710 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16713 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
16714 LDKOpenChannel this_ptr_conv;
16715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16716 this_ptr_conv.is_owned = false;
16717 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
16721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
16722 LDKOpenChannel this_ptr_conv;
16723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16724 this_ptr_conv.is_owned = false;
16725 OpenChannel_set_channel_flags(&this_ptr_conv, val);
16728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16729 LDKOpenChannel orig_conv;
16730 orig_conv.inner = (void*)(orig & (~1));
16731 orig_conv.is_owned = false;
16732 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
16733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16735 uint64_t ret_ref = (uint64_t)ret_var.inner;
16736 if (ret_var.is_owned) {
16742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16743 LDKAcceptChannel this_obj_conv;
16744 this_obj_conv.inner = (void*)(this_obj & (~1));
16745 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16746 AcceptChannel_free(this_obj_conv);
16749 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16750 LDKAcceptChannel this_ptr_conv;
16751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16752 this_ptr_conv.is_owned = false;
16753 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16754 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
16758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16759 LDKAcceptChannel this_ptr_conv;
16760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16761 this_ptr_conv.is_owned = false;
16762 LDKThirtyTwoBytes val_ref;
16763 CHECK((*env)->GetArrayLength(env, val) == 32);
16764 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16765 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16769 LDKAcceptChannel this_ptr_conv;
16770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16771 this_ptr_conv.is_owned = false;
16772 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
16776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16777 LDKAcceptChannel this_ptr_conv;
16778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16779 this_ptr_conv.is_owned = false;
16780 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16783 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) {
16784 LDKAcceptChannel this_ptr_conv;
16785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16786 this_ptr_conv.is_owned = false;
16787 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16791 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) {
16792 LDKAcceptChannel this_ptr_conv;
16793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16794 this_ptr_conv.is_owned = false;
16795 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16799 LDKAcceptChannel this_ptr_conv;
16800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16801 this_ptr_conv.is_owned = false;
16802 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16807 LDKAcceptChannel this_ptr_conv;
16808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16809 this_ptr_conv.is_owned = false;
16810 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16814 LDKAcceptChannel this_ptr_conv;
16815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16816 this_ptr_conv.is_owned = false;
16817 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
16821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16822 LDKAcceptChannel this_ptr_conv;
16823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16824 this_ptr_conv.is_owned = false;
16825 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16828 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
16829 LDKAcceptChannel this_ptr_conv;
16830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16831 this_ptr_conv.is_owned = false;
16832 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
16836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16837 LDKAcceptChannel this_ptr_conv;
16838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16839 this_ptr_conv.is_owned = false;
16840 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
16843 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16844 LDKAcceptChannel this_ptr_conv;
16845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16846 this_ptr_conv.is_owned = false;
16847 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
16851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16852 LDKAcceptChannel this_ptr_conv;
16853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16854 this_ptr_conv.is_owned = false;
16855 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
16858 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16859 LDKAcceptChannel this_ptr_conv;
16860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16861 this_ptr_conv.is_owned = false;
16862 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
16866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16867 LDKAcceptChannel this_ptr_conv;
16868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16869 this_ptr_conv.is_owned = false;
16870 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16874 LDKAcceptChannel this_ptr_conv;
16875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16876 this_ptr_conv.is_owned = false;
16877 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16878 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
16882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16883 LDKAcceptChannel this_ptr_conv;
16884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16885 this_ptr_conv.is_owned = false;
16886 LDKPublicKey val_ref;
16887 CHECK((*env)->GetArrayLength(env, val) == 33);
16888 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16889 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16893 LDKAcceptChannel this_ptr_conv;
16894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16895 this_ptr_conv.is_owned = false;
16896 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16897 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16902 LDKAcceptChannel this_ptr_conv;
16903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16904 this_ptr_conv.is_owned = false;
16905 LDKPublicKey val_ref;
16906 CHECK((*env)->GetArrayLength(env, val) == 33);
16907 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16908 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16912 LDKAcceptChannel this_ptr_conv;
16913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16914 this_ptr_conv.is_owned = false;
16915 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16916 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
16920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16921 LDKAcceptChannel this_ptr_conv;
16922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16923 this_ptr_conv.is_owned = false;
16924 LDKPublicKey val_ref;
16925 CHECK((*env)->GetArrayLength(env, val) == 33);
16926 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16927 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
16930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16931 LDKAcceptChannel this_ptr_conv;
16932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16933 this_ptr_conv.is_owned = false;
16934 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16935 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16940 LDKAcceptChannel this_ptr_conv;
16941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16942 this_ptr_conv.is_owned = false;
16943 LDKPublicKey val_ref;
16944 CHECK((*env)->GetArrayLength(env, val) == 33);
16945 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16946 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16950 LDKAcceptChannel this_ptr_conv;
16951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16952 this_ptr_conv.is_owned = false;
16953 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16954 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16959 LDKAcceptChannel this_ptr_conv;
16960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16961 this_ptr_conv.is_owned = false;
16962 LDKPublicKey val_ref;
16963 CHECK((*env)->GetArrayLength(env, val) == 33);
16964 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16965 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16969 LDKAcceptChannel this_ptr_conv;
16970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16971 this_ptr_conv.is_owned = false;
16972 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16973 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
16977 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) {
16978 LDKAcceptChannel this_ptr_conv;
16979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16980 this_ptr_conv.is_owned = false;
16981 LDKPublicKey val_ref;
16982 CHECK((*env)->GetArrayLength(env, val) == 33);
16983 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16984 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16988 LDKAcceptChannel orig_conv;
16989 orig_conv.inner = (void*)(orig & (~1));
16990 orig_conv.is_owned = false;
16991 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
16992 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16993 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16994 uint64_t ret_ref = (uint64_t)ret_var.inner;
16995 if (ret_var.is_owned) {
17001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17002 LDKFundingCreated this_obj_conv;
17003 this_obj_conv.inner = (void*)(this_obj & (~1));
17004 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17005 FundingCreated_free(this_obj_conv);
17008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17009 LDKFundingCreated this_ptr_conv;
17010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17011 this_ptr_conv.is_owned = false;
17012 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17013 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
17017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17018 LDKFundingCreated this_ptr_conv;
17019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17020 this_ptr_conv.is_owned = false;
17021 LDKThirtyTwoBytes val_ref;
17022 CHECK((*env)->GetArrayLength(env, val) == 32);
17023 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17024 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
17027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
17028 LDKFundingCreated this_ptr_conv;
17029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17030 this_ptr_conv.is_owned = false;
17031 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17032 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
17036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17037 LDKFundingCreated this_ptr_conv;
17038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17039 this_ptr_conv.is_owned = false;
17040 LDKThirtyTwoBytes val_ref;
17041 CHECK((*env)->GetArrayLength(env, val) == 32);
17042 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17043 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
17046 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
17047 LDKFundingCreated this_ptr_conv;
17048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17049 this_ptr_conv.is_owned = false;
17050 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
17054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17055 LDKFundingCreated this_ptr_conv;
17056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17057 this_ptr_conv.is_owned = false;
17058 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
17061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17062 LDKFundingCreated this_ptr_conv;
17063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17064 this_ptr_conv.is_owned = false;
17065 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17066 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
17070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17071 LDKFundingCreated this_ptr_conv;
17072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17073 this_ptr_conv.is_owned = false;
17074 LDKSignature val_ref;
17075 CHECK((*env)->GetArrayLength(env, val) == 64);
17076 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17077 FundingCreated_set_signature(&this_ptr_conv, val_ref);
17080 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) {
17081 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
17082 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
17083 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
17084 LDKThirtyTwoBytes funding_txid_arg_ref;
17085 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
17086 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
17087 LDKSignature signature_arg_ref;
17088 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17089 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17090 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
17091 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17092 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17093 uint64_t ret_ref = (uint64_t)ret_var.inner;
17094 if (ret_var.is_owned) {
17100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17101 LDKFundingCreated orig_conv;
17102 orig_conv.inner = (void*)(orig & (~1));
17103 orig_conv.is_owned = false;
17104 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
17105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17107 uint64_t ret_ref = (uint64_t)ret_var.inner;
17108 if (ret_var.is_owned) {
17114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17115 LDKFundingSigned this_obj_conv;
17116 this_obj_conv.inner = (void*)(this_obj & (~1));
17117 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17118 FundingSigned_free(this_obj_conv);
17121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17122 LDKFundingSigned this_ptr_conv;
17123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17124 this_ptr_conv.is_owned = false;
17125 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17126 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
17130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17131 LDKFundingSigned this_ptr_conv;
17132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17133 this_ptr_conv.is_owned = false;
17134 LDKThirtyTwoBytes val_ref;
17135 CHECK((*env)->GetArrayLength(env, val) == 32);
17136 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17137 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17141 LDKFundingSigned this_ptr_conv;
17142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17143 this_ptr_conv.is_owned = false;
17144 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17145 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
17149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17150 LDKFundingSigned this_ptr_conv;
17151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17152 this_ptr_conv.is_owned = false;
17153 LDKSignature val_ref;
17154 CHECK((*env)->GetArrayLength(env, val) == 64);
17155 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17156 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
17160 LDKThirtyTwoBytes channel_id_arg_ref;
17161 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17162 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17163 LDKSignature signature_arg_ref;
17164 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17165 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17166 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17167 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17168 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17169 uint64_t ret_ref = (uint64_t)ret_var.inner;
17170 if (ret_var.is_owned) {
17176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17177 LDKFundingSigned orig_conv;
17178 orig_conv.inner = (void*)(orig & (~1));
17179 orig_conv.is_owned = false;
17180 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17183 uint64_t ret_ref = (uint64_t)ret_var.inner;
17184 if (ret_var.is_owned) {
17190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17191 LDKFundingLocked this_obj_conv;
17192 this_obj_conv.inner = (void*)(this_obj & (~1));
17193 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17194 FundingLocked_free(this_obj_conv);
17197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17198 LDKFundingLocked this_ptr_conv;
17199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17200 this_ptr_conv.is_owned = false;
17201 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17202 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
17206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17207 LDKFundingLocked this_ptr_conv;
17208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17209 this_ptr_conv.is_owned = false;
17210 LDKThirtyTwoBytes val_ref;
17211 CHECK((*env)->GetArrayLength(env, val) == 32);
17212 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17213 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
17216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17217 LDKFundingLocked this_ptr_conv;
17218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17219 this_ptr_conv.is_owned = false;
17220 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17221 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
17225 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) {
17226 LDKFundingLocked this_ptr_conv;
17227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17228 this_ptr_conv.is_owned = false;
17229 LDKPublicKey val_ref;
17230 CHECK((*env)->GetArrayLength(env, val) == 33);
17231 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17232 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17235 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) {
17236 LDKThirtyTwoBytes channel_id_arg_ref;
17237 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17238 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17239 LDKPublicKey next_per_commitment_point_arg_ref;
17240 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
17241 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
17242 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
17243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17245 uint64_t ret_ref = (uint64_t)ret_var.inner;
17246 if (ret_var.is_owned) {
17252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17253 LDKFundingLocked orig_conv;
17254 orig_conv.inner = (void*)(orig & (~1));
17255 orig_conv.is_owned = false;
17256 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
17257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17259 uint64_t ret_ref = (uint64_t)ret_var.inner;
17260 if (ret_var.is_owned) {
17266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17267 LDKShutdown this_obj_conv;
17268 this_obj_conv.inner = (void*)(this_obj & (~1));
17269 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17270 Shutdown_free(this_obj_conv);
17273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17274 LDKShutdown this_ptr_conv;
17275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17276 this_ptr_conv.is_owned = false;
17277 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17278 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
17282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17283 LDKShutdown this_ptr_conv;
17284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17285 this_ptr_conv.is_owned = false;
17286 LDKThirtyTwoBytes val_ref;
17287 CHECK((*env)->GetArrayLength(env, val) == 32);
17288 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17289 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
17292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17293 LDKShutdown this_ptr_conv;
17294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17295 this_ptr_conv.is_owned = false;
17296 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
17297 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17298 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17303 LDKShutdown this_ptr_conv;
17304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17305 this_ptr_conv.is_owned = false;
17306 LDKCVec_u8Z val_ref;
17307 val_ref.datalen = (*env)->GetArrayLength(env, val);
17308 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17309 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
17310 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
17313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
17314 LDKThirtyTwoBytes channel_id_arg_ref;
17315 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17316 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17317 LDKCVec_u8Z scriptpubkey_arg_ref;
17318 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
17319 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17320 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
17321 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
17322 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17323 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17324 uint64_t ret_ref = (uint64_t)ret_var.inner;
17325 if (ret_var.is_owned) {
17331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17332 LDKShutdown orig_conv;
17333 orig_conv.inner = (void*)(orig & (~1));
17334 orig_conv.is_owned = false;
17335 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
17336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17338 uint64_t ret_ref = (uint64_t)ret_var.inner;
17339 if (ret_var.is_owned) {
17345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17346 LDKClosingSigned this_obj_conv;
17347 this_obj_conv.inner = (void*)(this_obj & (~1));
17348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17349 ClosingSigned_free(this_obj_conv);
17352 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17353 LDKClosingSigned this_ptr_conv;
17354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17355 this_ptr_conv.is_owned = false;
17356 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17357 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
17361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17362 LDKClosingSigned this_ptr_conv;
17363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17364 this_ptr_conv.is_owned = false;
17365 LDKThirtyTwoBytes val_ref;
17366 CHECK((*env)->GetArrayLength(env, val) == 32);
17367 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17368 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
17371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17372 LDKClosingSigned this_ptr_conv;
17373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17374 this_ptr_conv.is_owned = false;
17375 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
17379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17380 LDKClosingSigned this_ptr_conv;
17381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17382 this_ptr_conv.is_owned = false;
17383 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
17386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17387 LDKClosingSigned this_ptr_conv;
17388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17389 this_ptr_conv.is_owned = false;
17390 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17391 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
17395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17396 LDKClosingSigned this_ptr_conv;
17397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17398 this_ptr_conv.is_owned = false;
17399 LDKSignature val_ref;
17400 CHECK((*env)->GetArrayLength(env, val) == 64);
17401 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17402 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
17405 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) {
17406 LDKThirtyTwoBytes channel_id_arg_ref;
17407 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17408 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17409 LDKSignature signature_arg_ref;
17410 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17411 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17412 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
17413 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17414 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17415 uint64_t ret_ref = (uint64_t)ret_var.inner;
17416 if (ret_var.is_owned) {
17422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17423 LDKClosingSigned orig_conv;
17424 orig_conv.inner = (void*)(orig & (~1));
17425 orig_conv.is_owned = false;
17426 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
17427 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17428 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17429 uint64_t ret_ref = (uint64_t)ret_var.inner;
17430 if (ret_var.is_owned) {
17436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17437 LDKUpdateAddHTLC this_obj_conv;
17438 this_obj_conv.inner = (void*)(this_obj & (~1));
17439 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17440 UpdateAddHTLC_free(this_obj_conv);
17443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17444 LDKUpdateAddHTLC this_ptr_conv;
17445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17446 this_ptr_conv.is_owned = false;
17447 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17448 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
17452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17453 LDKUpdateAddHTLC this_ptr_conv;
17454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17455 this_ptr_conv.is_owned = false;
17456 LDKThirtyTwoBytes val_ref;
17457 CHECK((*env)->GetArrayLength(env, val) == 32);
17458 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17459 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
17462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17463 LDKUpdateAddHTLC this_ptr_conv;
17464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17465 this_ptr_conv.is_owned = false;
17466 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
17470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17471 LDKUpdateAddHTLC this_ptr_conv;
17472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17473 this_ptr_conv.is_owned = false;
17474 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
17477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17478 LDKUpdateAddHTLC this_ptr_conv;
17479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17480 this_ptr_conv.is_owned = false;
17481 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
17485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17486 LDKUpdateAddHTLC this_ptr_conv;
17487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17488 this_ptr_conv.is_owned = false;
17489 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
17492 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17493 LDKUpdateAddHTLC this_ptr_conv;
17494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17495 this_ptr_conv.is_owned = false;
17496 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17497 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
17501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17502 LDKUpdateAddHTLC this_ptr_conv;
17503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17504 this_ptr_conv.is_owned = false;
17505 LDKThirtyTwoBytes val_ref;
17506 CHECK((*env)->GetArrayLength(env, val) == 32);
17507 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17508 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
17511 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
17512 LDKUpdateAddHTLC this_ptr_conv;
17513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17514 this_ptr_conv.is_owned = false;
17515 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
17519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17520 LDKUpdateAddHTLC this_ptr_conv;
17521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17522 this_ptr_conv.is_owned = false;
17523 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
17526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17527 LDKUpdateAddHTLC orig_conv;
17528 orig_conv.inner = (void*)(orig & (~1));
17529 orig_conv.is_owned = false;
17530 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
17531 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17532 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17533 uint64_t ret_ref = (uint64_t)ret_var.inner;
17534 if (ret_var.is_owned) {
17540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17541 LDKUpdateFulfillHTLC this_obj_conv;
17542 this_obj_conv.inner = (void*)(this_obj & (~1));
17543 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17544 UpdateFulfillHTLC_free(this_obj_conv);
17547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17548 LDKUpdateFulfillHTLC this_ptr_conv;
17549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17550 this_ptr_conv.is_owned = false;
17551 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17552 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
17556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17557 LDKUpdateFulfillHTLC this_ptr_conv;
17558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17559 this_ptr_conv.is_owned = false;
17560 LDKThirtyTwoBytes val_ref;
17561 CHECK((*env)->GetArrayLength(env, val) == 32);
17562 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17563 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
17566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17567 LDKUpdateFulfillHTLC this_ptr_conv;
17568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17569 this_ptr_conv.is_owned = false;
17570 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
17574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17575 LDKUpdateFulfillHTLC this_ptr_conv;
17576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17577 this_ptr_conv.is_owned = false;
17578 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
17581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
17582 LDKUpdateFulfillHTLC this_ptr_conv;
17583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17584 this_ptr_conv.is_owned = false;
17585 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17586 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
17590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17591 LDKUpdateFulfillHTLC this_ptr_conv;
17592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17593 this_ptr_conv.is_owned = false;
17594 LDKThirtyTwoBytes val_ref;
17595 CHECK((*env)->GetArrayLength(env, val) == 32);
17596 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17597 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
17600 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) {
17601 LDKThirtyTwoBytes channel_id_arg_ref;
17602 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17603 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17604 LDKThirtyTwoBytes payment_preimage_arg_ref;
17605 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
17606 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
17607 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
17608 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17609 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17610 uint64_t ret_ref = (uint64_t)ret_var.inner;
17611 if (ret_var.is_owned) {
17617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17618 LDKUpdateFulfillHTLC orig_conv;
17619 orig_conv.inner = (void*)(orig & (~1));
17620 orig_conv.is_owned = false;
17621 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
17622 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17623 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17624 uint64_t ret_ref = (uint64_t)ret_var.inner;
17625 if (ret_var.is_owned) {
17631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17632 LDKUpdateFailHTLC this_obj_conv;
17633 this_obj_conv.inner = (void*)(this_obj & (~1));
17634 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17635 UpdateFailHTLC_free(this_obj_conv);
17638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17639 LDKUpdateFailHTLC this_ptr_conv;
17640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17641 this_ptr_conv.is_owned = false;
17642 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17643 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
17647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17648 LDKUpdateFailHTLC this_ptr_conv;
17649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17650 this_ptr_conv.is_owned = false;
17651 LDKThirtyTwoBytes val_ref;
17652 CHECK((*env)->GetArrayLength(env, val) == 32);
17653 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17654 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
17657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17658 LDKUpdateFailHTLC this_ptr_conv;
17659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17660 this_ptr_conv.is_owned = false;
17661 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
17665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17666 LDKUpdateFailHTLC this_ptr_conv;
17667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17668 this_ptr_conv.is_owned = false;
17669 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
17672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17673 LDKUpdateFailHTLC orig_conv;
17674 orig_conv.inner = (void*)(orig & (~1));
17675 orig_conv.is_owned = false;
17676 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
17677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17679 uint64_t ret_ref = (uint64_t)ret_var.inner;
17680 if (ret_var.is_owned) {
17686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17687 LDKUpdateFailMalformedHTLC this_obj_conv;
17688 this_obj_conv.inner = (void*)(this_obj & (~1));
17689 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17690 UpdateFailMalformedHTLC_free(this_obj_conv);
17693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17694 LDKUpdateFailMalformedHTLC this_ptr_conv;
17695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17696 this_ptr_conv.is_owned = false;
17697 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17698 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
17702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17703 LDKUpdateFailMalformedHTLC this_ptr_conv;
17704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17705 this_ptr_conv.is_owned = false;
17706 LDKThirtyTwoBytes val_ref;
17707 CHECK((*env)->GetArrayLength(env, val) == 32);
17708 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17709 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
17712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17713 LDKUpdateFailMalformedHTLC this_ptr_conv;
17714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17715 this_ptr_conv.is_owned = false;
17716 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
17720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17721 LDKUpdateFailMalformedHTLC this_ptr_conv;
17722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17723 this_ptr_conv.is_owned = false;
17724 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
17727 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
17728 LDKUpdateFailMalformedHTLC this_ptr_conv;
17729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17730 this_ptr_conv.is_owned = false;
17731 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
17735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17736 LDKUpdateFailMalformedHTLC this_ptr_conv;
17737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17738 this_ptr_conv.is_owned = false;
17739 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
17742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17743 LDKUpdateFailMalformedHTLC orig_conv;
17744 orig_conv.inner = (void*)(orig & (~1));
17745 orig_conv.is_owned = false;
17746 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
17747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17749 uint64_t ret_ref = (uint64_t)ret_var.inner;
17750 if (ret_var.is_owned) {
17756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17757 LDKCommitmentSigned this_obj_conv;
17758 this_obj_conv.inner = (void*)(this_obj & (~1));
17759 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17760 CommitmentSigned_free(this_obj_conv);
17763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17764 LDKCommitmentSigned this_ptr_conv;
17765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17766 this_ptr_conv.is_owned = false;
17767 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17768 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
17772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17773 LDKCommitmentSigned this_ptr_conv;
17774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17775 this_ptr_conv.is_owned = false;
17776 LDKThirtyTwoBytes val_ref;
17777 CHECK((*env)->GetArrayLength(env, val) == 32);
17778 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17779 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
17782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17783 LDKCommitmentSigned this_ptr_conv;
17784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17785 this_ptr_conv.is_owned = false;
17786 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17787 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
17791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17792 LDKCommitmentSigned this_ptr_conv;
17793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17794 this_ptr_conv.is_owned = false;
17795 LDKSignature val_ref;
17796 CHECK((*env)->GetArrayLength(env, val) == 64);
17797 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17798 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
17801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
17802 LDKCommitmentSigned this_ptr_conv;
17803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17804 this_ptr_conv.is_owned = false;
17805 LDKCVec_SignatureZ val_constr;
17806 val_constr.datalen = (*env)->GetArrayLength(env, val);
17807 if (val_constr.datalen > 0)
17808 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17810 val_constr.data = NULL;
17811 for (size_t i = 0; i < val_constr.datalen; i++) {
17812 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
17813 LDKSignature val_conv_8_ref;
17814 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
17815 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
17816 val_constr.data[i] = val_conv_8_ref;
17818 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
17821 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) {
17822 LDKThirtyTwoBytes channel_id_arg_ref;
17823 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17824 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17825 LDKSignature signature_arg_ref;
17826 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17827 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17828 LDKCVec_SignatureZ htlc_signatures_arg_constr;
17829 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
17830 if (htlc_signatures_arg_constr.datalen > 0)
17831 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17833 htlc_signatures_arg_constr.data = NULL;
17834 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
17835 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
17836 LDKSignature htlc_signatures_arg_conv_8_ref;
17837 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
17838 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
17839 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
17841 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
17842 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17843 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17844 uint64_t ret_ref = (uint64_t)ret_var.inner;
17845 if (ret_var.is_owned) {
17851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17852 LDKCommitmentSigned orig_conv;
17853 orig_conv.inner = (void*)(orig & (~1));
17854 orig_conv.is_owned = false;
17855 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
17856 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17857 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17858 uint64_t ret_ref = (uint64_t)ret_var.inner;
17859 if (ret_var.is_owned) {
17865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17866 LDKRevokeAndACK this_obj_conv;
17867 this_obj_conv.inner = (void*)(this_obj & (~1));
17868 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17869 RevokeAndACK_free(this_obj_conv);
17872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17873 LDKRevokeAndACK this_ptr_conv;
17874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17875 this_ptr_conv.is_owned = false;
17876 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17877 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
17881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17882 LDKRevokeAndACK this_ptr_conv;
17883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17884 this_ptr_conv.is_owned = false;
17885 LDKThirtyTwoBytes val_ref;
17886 CHECK((*env)->GetArrayLength(env, val) == 32);
17887 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17888 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
17891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
17892 LDKRevokeAndACK this_ptr_conv;
17893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17894 this_ptr_conv.is_owned = false;
17895 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17896 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
17900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17901 LDKRevokeAndACK this_ptr_conv;
17902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17903 this_ptr_conv.is_owned = false;
17904 LDKThirtyTwoBytes val_ref;
17905 CHECK((*env)->GetArrayLength(env, val) == 32);
17906 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17907 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
17910 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17911 LDKRevokeAndACK this_ptr_conv;
17912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17913 this_ptr_conv.is_owned = false;
17914 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17915 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
17919 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) {
17920 LDKRevokeAndACK this_ptr_conv;
17921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17922 this_ptr_conv.is_owned = false;
17923 LDKPublicKey val_ref;
17924 CHECK((*env)->GetArrayLength(env, val) == 33);
17925 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17926 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17929 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) {
17930 LDKThirtyTwoBytes channel_id_arg_ref;
17931 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17932 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17933 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
17934 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
17935 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
17936 LDKPublicKey next_per_commitment_point_arg_ref;
17937 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
17938 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
17939 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
17940 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17941 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17942 uint64_t ret_ref = (uint64_t)ret_var.inner;
17943 if (ret_var.is_owned) {
17949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17950 LDKRevokeAndACK orig_conv;
17951 orig_conv.inner = (void*)(orig & (~1));
17952 orig_conv.is_owned = false;
17953 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
17954 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17955 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17956 uint64_t ret_ref = (uint64_t)ret_var.inner;
17957 if (ret_var.is_owned) {
17963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17964 LDKUpdateFee this_obj_conv;
17965 this_obj_conv.inner = (void*)(this_obj & (~1));
17966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17967 UpdateFee_free(this_obj_conv);
17970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17971 LDKUpdateFee this_ptr_conv;
17972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17973 this_ptr_conv.is_owned = false;
17974 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17975 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
17979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17980 LDKUpdateFee this_ptr_conv;
17981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17982 this_ptr_conv.is_owned = false;
17983 LDKThirtyTwoBytes val_ref;
17984 CHECK((*env)->GetArrayLength(env, val) == 32);
17985 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17986 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
17989 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
17990 LDKUpdateFee this_ptr_conv;
17991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17992 this_ptr_conv.is_owned = false;
17993 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
17997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17998 LDKUpdateFee this_ptr_conv;
17999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18000 this_ptr_conv.is_owned = false;
18001 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
18004 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) {
18005 LDKThirtyTwoBytes channel_id_arg_ref;
18006 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18007 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18008 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
18009 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18010 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18011 uint64_t ret_ref = (uint64_t)ret_var.inner;
18012 if (ret_var.is_owned) {
18018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18019 LDKUpdateFee orig_conv;
18020 orig_conv.inner = (void*)(orig & (~1));
18021 orig_conv.is_owned = false;
18022 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18023 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18024 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18025 uint64_t ret_ref = (uint64_t)ret_var.inner;
18026 if (ret_var.is_owned) {
18032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18033 LDKDataLossProtect this_obj_conv;
18034 this_obj_conv.inner = (void*)(this_obj & (~1));
18035 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18036 DataLossProtect_free(this_obj_conv);
18039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
18040 LDKDataLossProtect this_ptr_conv;
18041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18042 this_ptr_conv.is_owned = false;
18043 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18044 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
18048 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) {
18049 LDKDataLossProtect this_ptr_conv;
18050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18051 this_ptr_conv.is_owned = false;
18052 LDKThirtyTwoBytes val_ref;
18053 CHECK((*env)->GetArrayLength(env, val) == 32);
18054 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18055 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18059 LDKDataLossProtect this_ptr_conv;
18060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18061 this_ptr_conv.is_owned = false;
18062 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18063 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
18067 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) {
18068 LDKDataLossProtect this_ptr_conv;
18069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18070 this_ptr_conv.is_owned = false;
18071 LDKPublicKey val_ref;
18072 CHECK((*env)->GetArrayLength(env, val) == 33);
18073 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18074 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18077 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) {
18078 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18079 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
18080 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
18081 LDKPublicKey my_current_per_commitment_point_arg_ref;
18082 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
18083 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
18084 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18085 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18086 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18087 uint64_t ret_ref = (uint64_t)ret_var.inner;
18088 if (ret_var.is_owned) {
18094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18095 LDKDataLossProtect orig_conv;
18096 orig_conv.inner = (void*)(orig & (~1));
18097 orig_conv.is_owned = false;
18098 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18101 uint64_t ret_ref = (uint64_t)ret_var.inner;
18102 if (ret_var.is_owned) {
18108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18109 LDKChannelReestablish this_obj_conv;
18110 this_obj_conv.inner = (void*)(this_obj & (~1));
18111 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18112 ChannelReestablish_free(this_obj_conv);
18115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18116 LDKChannelReestablish this_ptr_conv;
18117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18118 this_ptr_conv.is_owned = false;
18119 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18120 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
18124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18125 LDKChannelReestablish this_ptr_conv;
18126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18127 this_ptr_conv.is_owned = false;
18128 LDKThirtyTwoBytes val_ref;
18129 CHECK((*env)->GetArrayLength(env, val) == 32);
18130 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18131 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18135 LDKChannelReestablish this_ptr_conv;
18136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18137 this_ptr_conv.is_owned = false;
18138 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18142 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) {
18143 LDKChannelReestablish this_ptr_conv;
18144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18145 this_ptr_conv.is_owned = false;
18146 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18150 LDKChannelReestablish this_ptr_conv;
18151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18152 this_ptr_conv.is_owned = false;
18153 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18157 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) {
18158 LDKChannelReestablish this_ptr_conv;
18159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18160 this_ptr_conv.is_owned = false;
18161 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18165 LDKChannelReestablish orig_conv;
18166 orig_conv.inner = (void*)(orig & (~1));
18167 orig_conv.is_owned = false;
18168 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18169 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18170 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18171 uint64_t ret_ref = (uint64_t)ret_var.inner;
18172 if (ret_var.is_owned) {
18178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18179 LDKAnnouncementSignatures this_obj_conv;
18180 this_obj_conv.inner = (void*)(this_obj & (~1));
18181 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18182 AnnouncementSignatures_free(this_obj_conv);
18185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18186 LDKAnnouncementSignatures this_ptr_conv;
18187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18188 this_ptr_conv.is_owned = false;
18189 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18190 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
18194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18195 LDKAnnouncementSignatures this_ptr_conv;
18196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18197 this_ptr_conv.is_owned = false;
18198 LDKThirtyTwoBytes val_ref;
18199 CHECK((*env)->GetArrayLength(env, val) == 32);
18200 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18201 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
18204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18205 LDKAnnouncementSignatures this_ptr_conv;
18206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18207 this_ptr_conv.is_owned = false;
18208 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
18212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18213 LDKAnnouncementSignatures this_ptr_conv;
18214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18215 this_ptr_conv.is_owned = false;
18216 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
18219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18220 LDKAnnouncementSignatures this_ptr_conv;
18221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18222 this_ptr_conv.is_owned = false;
18223 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18224 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
18228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18229 LDKAnnouncementSignatures this_ptr_conv;
18230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18231 this_ptr_conv.is_owned = false;
18232 LDKSignature val_ref;
18233 CHECK((*env)->GetArrayLength(env, val) == 64);
18234 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18235 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
18238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18239 LDKAnnouncementSignatures this_ptr_conv;
18240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18241 this_ptr_conv.is_owned = false;
18242 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18243 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
18247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18248 LDKAnnouncementSignatures this_ptr_conv;
18249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18250 this_ptr_conv.is_owned = false;
18251 LDKSignature val_ref;
18252 CHECK((*env)->GetArrayLength(env, val) == 64);
18253 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18254 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
18257 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) {
18258 LDKThirtyTwoBytes channel_id_arg_ref;
18259 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18260 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18261 LDKSignature node_signature_arg_ref;
18262 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
18263 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
18264 LDKSignature bitcoin_signature_arg_ref;
18265 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
18266 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
18267 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
18268 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18269 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18270 uint64_t ret_ref = (uint64_t)ret_var.inner;
18271 if (ret_var.is_owned) {
18277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18278 LDKAnnouncementSignatures orig_conv;
18279 orig_conv.inner = (void*)(orig & (~1));
18280 orig_conv.is_owned = false;
18281 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
18282 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18283 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18284 uint64_t ret_ref = (uint64_t)ret_var.inner;
18285 if (ret_var.is_owned) {
18291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18292 if ((this_ptr & 1) != 0) return;
18293 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
18294 FREE((void*)this_ptr);
18295 NetAddress_free(this_ptr_conv);
18298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18299 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
18300 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18301 *ret_copy = NetAddress_clone(orig_conv);
18302 uint64_t ret_ref = (uint64_t)ret_copy;
18306 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
18307 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
18308 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
18309 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18310 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18311 CVec_u8Z_free(ret_var);
18315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18316 LDKu8slice ser_ref;
18317 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18318 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18319 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
18320 *ret_conv = Result_read(ser_ref);
18321 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18322 return (uint64_t)ret_conv;
18325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18326 LDKu8slice ser_ref;
18327 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18328 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18329 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18330 *ret_conv = NetAddress_read(ser_ref);
18331 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18332 return (uint64_t)ret_conv;
18335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18336 LDKUnsignedNodeAnnouncement this_obj_conv;
18337 this_obj_conv.inner = (void*)(this_obj & (~1));
18338 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18339 UnsignedNodeAnnouncement_free(this_obj_conv);
18342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18343 LDKUnsignedNodeAnnouncement this_ptr_conv;
18344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18345 this_ptr_conv.is_owned = false;
18346 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
18347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18349 uint64_t ret_ref = (uint64_t)ret_var.inner;
18350 if (ret_var.is_owned) {
18356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18357 LDKUnsignedNodeAnnouncement this_ptr_conv;
18358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18359 this_ptr_conv.is_owned = false;
18360 LDKNodeFeatures val_conv;
18361 val_conv.inner = (void*)(val & (~1));
18362 val_conv.is_owned = (val & 1) || (val == 0);
18363 val_conv = NodeFeatures_clone(&val_conv);
18364 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
18367 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
18368 LDKUnsignedNodeAnnouncement this_ptr_conv;
18369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18370 this_ptr_conv.is_owned = false;
18371 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
18375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18376 LDKUnsignedNodeAnnouncement this_ptr_conv;
18377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18378 this_ptr_conv.is_owned = false;
18379 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
18382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18383 LDKUnsignedNodeAnnouncement this_ptr_conv;
18384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18385 this_ptr_conv.is_owned = false;
18386 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18387 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
18391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18392 LDKUnsignedNodeAnnouncement this_ptr_conv;
18393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18394 this_ptr_conv.is_owned = false;
18395 LDKPublicKey val_ref;
18396 CHECK((*env)->GetArrayLength(env, val) == 33);
18397 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18398 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
18401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
18402 LDKUnsignedNodeAnnouncement this_ptr_conv;
18403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18404 this_ptr_conv.is_owned = false;
18405 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
18406 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
18410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18411 LDKUnsignedNodeAnnouncement this_ptr_conv;
18412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18413 this_ptr_conv.is_owned = false;
18414 LDKThreeBytes val_ref;
18415 CHECK((*env)->GetArrayLength(env, val) == 3);
18416 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
18417 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
18420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
18421 LDKUnsignedNodeAnnouncement this_ptr_conv;
18422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18423 this_ptr_conv.is_owned = false;
18424 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18425 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
18429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18430 LDKUnsignedNodeAnnouncement this_ptr_conv;
18431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18432 this_ptr_conv.is_owned = false;
18433 LDKThirtyTwoBytes val_ref;
18434 CHECK((*env)->GetArrayLength(env, val) == 32);
18435 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18436 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
18439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
18440 LDKUnsignedNodeAnnouncement this_ptr_conv;
18441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18442 this_ptr_conv.is_owned = false;
18443 LDKCVec_NetAddressZ val_constr;
18444 val_constr.datalen = (*env)->GetArrayLength(env, val);
18445 if (val_constr.datalen > 0)
18446 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18448 val_constr.data = NULL;
18449 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
18450 for (size_t m = 0; m < val_constr.datalen; m++) {
18451 int64_t val_conv_12 = val_vals[m];
18452 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18453 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
18454 val_constr.data[m] = val_conv_12_conv;
18456 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
18457 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
18460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18461 LDKUnsignedNodeAnnouncement orig_conv;
18462 orig_conv.inner = (void*)(orig & (~1));
18463 orig_conv.is_owned = false;
18464 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
18465 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18466 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18467 uint64_t ret_ref = (uint64_t)ret_var.inner;
18468 if (ret_var.is_owned) {
18474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18475 LDKNodeAnnouncement this_obj_conv;
18476 this_obj_conv.inner = (void*)(this_obj & (~1));
18477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18478 NodeAnnouncement_free(this_obj_conv);
18481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18482 LDKNodeAnnouncement this_ptr_conv;
18483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18484 this_ptr_conv.is_owned = false;
18485 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18486 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
18490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18491 LDKNodeAnnouncement this_ptr_conv;
18492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18493 this_ptr_conv.is_owned = false;
18494 LDKSignature val_ref;
18495 CHECK((*env)->GetArrayLength(env, val) == 64);
18496 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18497 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
18500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
18501 LDKNodeAnnouncement this_ptr_conv;
18502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18503 this_ptr_conv.is_owned = false;
18504 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
18505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18507 uint64_t ret_ref = (uint64_t)ret_var.inner;
18508 if (ret_var.is_owned) {
18514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18515 LDKNodeAnnouncement this_ptr_conv;
18516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18517 this_ptr_conv.is_owned = false;
18518 LDKUnsignedNodeAnnouncement val_conv;
18519 val_conv.inner = (void*)(val & (~1));
18520 val_conv.is_owned = (val & 1) || (val == 0);
18521 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
18522 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
18525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
18526 LDKSignature signature_arg_ref;
18527 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18528 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18529 LDKUnsignedNodeAnnouncement contents_arg_conv;
18530 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18531 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18532 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
18533 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
18534 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18535 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18536 uint64_t ret_ref = (uint64_t)ret_var.inner;
18537 if (ret_var.is_owned) {
18543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18544 LDKNodeAnnouncement orig_conv;
18545 orig_conv.inner = (void*)(orig & (~1));
18546 orig_conv.is_owned = false;
18547 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
18548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18550 uint64_t ret_ref = (uint64_t)ret_var.inner;
18551 if (ret_var.is_owned) {
18557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18558 LDKUnsignedChannelAnnouncement this_obj_conv;
18559 this_obj_conv.inner = (void*)(this_obj & (~1));
18560 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18561 UnsignedChannelAnnouncement_free(this_obj_conv);
18564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18565 LDKUnsignedChannelAnnouncement this_ptr_conv;
18566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18567 this_ptr_conv.is_owned = false;
18568 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
18569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18571 uint64_t ret_ref = (uint64_t)ret_var.inner;
18572 if (ret_var.is_owned) {
18578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18579 LDKUnsignedChannelAnnouncement this_ptr_conv;
18580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18581 this_ptr_conv.is_owned = false;
18582 LDKChannelFeatures val_conv;
18583 val_conv.inner = (void*)(val & (~1));
18584 val_conv.is_owned = (val & 1) || (val == 0);
18585 val_conv = ChannelFeatures_clone(&val_conv);
18586 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
18589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18590 LDKUnsignedChannelAnnouncement this_ptr_conv;
18591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18592 this_ptr_conv.is_owned = false;
18593 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18594 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
18598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18599 LDKUnsignedChannelAnnouncement this_ptr_conv;
18600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18601 this_ptr_conv.is_owned = false;
18602 LDKThirtyTwoBytes val_ref;
18603 CHECK((*env)->GetArrayLength(env, val) == 32);
18604 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18605 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
18608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18609 LDKUnsignedChannelAnnouncement this_ptr_conv;
18610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18611 this_ptr_conv.is_owned = false;
18612 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
18616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18617 LDKUnsignedChannelAnnouncement this_ptr_conv;
18618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18619 this_ptr_conv.is_owned = false;
18620 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
18623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18624 LDKUnsignedChannelAnnouncement this_ptr_conv;
18625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18626 this_ptr_conv.is_owned = false;
18627 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18628 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
18632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18633 LDKUnsignedChannelAnnouncement this_ptr_conv;
18634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18635 this_ptr_conv.is_owned = false;
18636 LDKPublicKey val_ref;
18637 CHECK((*env)->GetArrayLength(env, val) == 33);
18638 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18639 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
18642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18643 LDKUnsignedChannelAnnouncement this_ptr_conv;
18644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18645 this_ptr_conv.is_owned = false;
18646 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18647 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
18651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18652 LDKUnsignedChannelAnnouncement this_ptr_conv;
18653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18654 this_ptr_conv.is_owned = false;
18655 LDKPublicKey val_ref;
18656 CHECK((*env)->GetArrayLength(env, val) == 33);
18657 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18658 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
18661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18662 LDKUnsignedChannelAnnouncement this_ptr_conv;
18663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18664 this_ptr_conv.is_owned = false;
18665 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18666 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
18670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18671 LDKUnsignedChannelAnnouncement this_ptr_conv;
18672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18673 this_ptr_conv.is_owned = false;
18674 LDKPublicKey val_ref;
18675 CHECK((*env)->GetArrayLength(env, val) == 33);
18676 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18677 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
18680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18681 LDKUnsignedChannelAnnouncement this_ptr_conv;
18682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18683 this_ptr_conv.is_owned = false;
18684 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18685 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
18689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18690 LDKUnsignedChannelAnnouncement this_ptr_conv;
18691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18692 this_ptr_conv.is_owned = false;
18693 LDKPublicKey val_ref;
18694 CHECK((*env)->GetArrayLength(env, val) == 33);
18695 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18696 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
18699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18700 LDKUnsignedChannelAnnouncement orig_conv;
18701 orig_conv.inner = (void*)(orig & (~1));
18702 orig_conv.is_owned = false;
18703 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
18704 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18705 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18706 uint64_t ret_ref = (uint64_t)ret_var.inner;
18707 if (ret_var.is_owned) {
18713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18714 LDKChannelAnnouncement this_obj_conv;
18715 this_obj_conv.inner = (void*)(this_obj & (~1));
18716 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18717 ChannelAnnouncement_free(this_obj_conv);
18720 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18721 LDKChannelAnnouncement this_ptr_conv;
18722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18723 this_ptr_conv.is_owned = false;
18724 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18725 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
18729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18730 LDKChannelAnnouncement this_ptr_conv;
18731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18732 this_ptr_conv.is_owned = false;
18733 LDKSignature val_ref;
18734 CHECK((*env)->GetArrayLength(env, val) == 64);
18735 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18736 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
18739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18740 LDKChannelAnnouncement this_ptr_conv;
18741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18742 this_ptr_conv.is_owned = false;
18743 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18744 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
18748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18749 LDKChannelAnnouncement this_ptr_conv;
18750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18751 this_ptr_conv.is_owned = false;
18752 LDKSignature val_ref;
18753 CHECK((*env)->GetArrayLength(env, val) == 64);
18754 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18755 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
18758 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18759 LDKChannelAnnouncement this_ptr_conv;
18760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18761 this_ptr_conv.is_owned = false;
18762 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18763 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
18767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18768 LDKChannelAnnouncement this_ptr_conv;
18769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18770 this_ptr_conv.is_owned = false;
18771 LDKSignature val_ref;
18772 CHECK((*env)->GetArrayLength(env, val) == 64);
18773 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18774 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
18777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18778 LDKChannelAnnouncement this_ptr_conv;
18779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18780 this_ptr_conv.is_owned = false;
18781 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18782 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
18786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18787 LDKChannelAnnouncement this_ptr_conv;
18788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18789 this_ptr_conv.is_owned = false;
18790 LDKSignature val_ref;
18791 CHECK((*env)->GetArrayLength(env, val) == 64);
18792 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18793 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
18796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
18797 LDKChannelAnnouncement this_ptr_conv;
18798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18799 this_ptr_conv.is_owned = false;
18800 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
18801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18803 uint64_t ret_ref = (uint64_t)ret_var.inner;
18804 if (ret_var.is_owned) {
18810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18811 LDKChannelAnnouncement this_ptr_conv;
18812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18813 this_ptr_conv.is_owned = false;
18814 LDKUnsignedChannelAnnouncement val_conv;
18815 val_conv.inner = (void*)(val & (~1));
18816 val_conv.is_owned = (val & 1) || (val == 0);
18817 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
18818 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
18821 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) {
18822 LDKSignature node_signature_1_arg_ref;
18823 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
18824 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
18825 LDKSignature node_signature_2_arg_ref;
18826 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
18827 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
18828 LDKSignature bitcoin_signature_1_arg_ref;
18829 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
18830 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
18831 LDKSignature bitcoin_signature_2_arg_ref;
18832 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
18833 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
18834 LDKUnsignedChannelAnnouncement contents_arg_conv;
18835 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18836 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18837 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
18838 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);
18839 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18840 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18841 uint64_t ret_ref = (uint64_t)ret_var.inner;
18842 if (ret_var.is_owned) {
18848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18849 LDKChannelAnnouncement orig_conv;
18850 orig_conv.inner = (void*)(orig & (~1));
18851 orig_conv.is_owned = false;
18852 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
18853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18855 uint64_t ret_ref = (uint64_t)ret_var.inner;
18856 if (ret_var.is_owned) {
18862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18863 LDKUnsignedChannelUpdate this_obj_conv;
18864 this_obj_conv.inner = (void*)(this_obj & (~1));
18865 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18866 UnsignedChannelUpdate_free(this_obj_conv);
18869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18870 LDKUnsignedChannelUpdate this_ptr_conv;
18871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18872 this_ptr_conv.is_owned = false;
18873 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18874 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
18878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18879 LDKUnsignedChannelUpdate this_ptr_conv;
18880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18881 this_ptr_conv.is_owned = false;
18882 LDKThirtyTwoBytes val_ref;
18883 CHECK((*env)->GetArrayLength(env, val) == 32);
18884 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18885 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
18888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18889 LDKUnsignedChannelUpdate this_ptr_conv;
18890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18891 this_ptr_conv.is_owned = false;
18892 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
18896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18897 LDKUnsignedChannelUpdate this_ptr_conv;
18898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18899 this_ptr_conv.is_owned = false;
18900 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
18903 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
18904 LDKUnsignedChannelUpdate this_ptr_conv;
18905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18906 this_ptr_conv.is_owned = false;
18907 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
18911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18912 LDKUnsignedChannelUpdate this_ptr_conv;
18913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18914 this_ptr_conv.is_owned = false;
18915 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
18918 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
18919 LDKUnsignedChannelUpdate this_ptr_conv;
18920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18921 this_ptr_conv.is_owned = false;
18922 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
18926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
18927 LDKUnsignedChannelUpdate this_ptr_conv;
18928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18929 this_ptr_conv.is_owned = false;
18930 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
18933 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18934 LDKUnsignedChannelUpdate this_ptr_conv;
18935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18936 this_ptr_conv.is_owned = false;
18937 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
18941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18942 LDKUnsignedChannelUpdate this_ptr_conv;
18943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18944 this_ptr_conv.is_owned = false;
18945 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
18948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18949 LDKUnsignedChannelUpdate this_ptr_conv;
18950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18951 this_ptr_conv.is_owned = false;
18952 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
18956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18957 LDKUnsignedChannelUpdate this_ptr_conv;
18958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18959 this_ptr_conv.is_owned = false;
18960 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
18963 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18964 LDKUnsignedChannelUpdate this_ptr_conv;
18965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18966 this_ptr_conv.is_owned = false;
18967 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
18971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18972 LDKUnsignedChannelUpdate this_ptr_conv;
18973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18974 this_ptr_conv.is_owned = false;
18975 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
18978 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
18979 LDKUnsignedChannelUpdate this_ptr_conv;
18980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18981 this_ptr_conv.is_owned = false;
18982 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
18986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18987 LDKUnsignedChannelUpdate this_ptr_conv;
18988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18989 this_ptr_conv.is_owned = false;
18990 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
18993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18994 LDKUnsignedChannelUpdate orig_conv;
18995 orig_conv.inner = (void*)(orig & (~1));
18996 orig_conv.is_owned = false;
18997 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
18998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19000 uint64_t ret_ref = (uint64_t)ret_var.inner;
19001 if (ret_var.is_owned) {
19007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19008 LDKChannelUpdate this_obj_conv;
19009 this_obj_conv.inner = (void*)(this_obj & (~1));
19010 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19011 ChannelUpdate_free(this_obj_conv);
19014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19015 LDKChannelUpdate this_ptr_conv;
19016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19017 this_ptr_conv.is_owned = false;
19018 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19019 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
19023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19024 LDKChannelUpdate this_ptr_conv;
19025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19026 this_ptr_conv.is_owned = false;
19027 LDKSignature val_ref;
19028 CHECK((*env)->GetArrayLength(env, val) == 64);
19029 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19030 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19034 LDKChannelUpdate this_ptr_conv;
19035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19036 this_ptr_conv.is_owned = false;
19037 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19040 uint64_t ret_ref = (uint64_t)ret_var.inner;
19041 if (ret_var.is_owned) {
19047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19048 LDKChannelUpdate this_ptr_conv;
19049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19050 this_ptr_conv.is_owned = false;
19051 LDKUnsignedChannelUpdate val_conv;
19052 val_conv.inner = (void*)(val & (~1));
19053 val_conv.is_owned = (val & 1) || (val == 0);
19054 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19055 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
19059 LDKSignature signature_arg_ref;
19060 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19061 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19062 LDKUnsignedChannelUpdate contents_arg_conv;
19063 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19064 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19065 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19066 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19067 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19068 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19069 uint64_t ret_ref = (uint64_t)ret_var.inner;
19070 if (ret_var.is_owned) {
19076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19077 LDKChannelUpdate orig_conv;
19078 orig_conv.inner = (void*)(orig & (~1));
19079 orig_conv.is_owned = false;
19080 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19081 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19082 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19083 uint64_t ret_ref = (uint64_t)ret_var.inner;
19084 if (ret_var.is_owned) {
19090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19091 LDKQueryChannelRange this_obj_conv;
19092 this_obj_conv.inner = (void*)(this_obj & (~1));
19093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19094 QueryChannelRange_free(this_obj_conv);
19097 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19098 LDKQueryChannelRange this_ptr_conv;
19099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19100 this_ptr_conv.is_owned = false;
19101 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19102 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
19106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19107 LDKQueryChannelRange this_ptr_conv;
19108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19109 this_ptr_conv.is_owned = false;
19110 LDKThirtyTwoBytes val_ref;
19111 CHECK((*env)->GetArrayLength(env, val) == 32);
19112 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19113 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19116 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19117 LDKQueryChannelRange this_ptr_conv;
19118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19119 this_ptr_conv.is_owned = false;
19120 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19125 LDKQueryChannelRange this_ptr_conv;
19126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19127 this_ptr_conv.is_owned = false;
19128 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19131 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19132 LDKQueryChannelRange this_ptr_conv;
19133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19134 this_ptr_conv.is_owned = false;
19135 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19140 LDKQueryChannelRange this_ptr_conv;
19141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19142 this_ptr_conv.is_owned = false;
19143 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19146 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) {
19147 LDKThirtyTwoBytes chain_hash_arg_ref;
19148 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19149 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19150 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19151 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19152 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19153 uint64_t ret_ref = (uint64_t)ret_var.inner;
19154 if (ret_var.is_owned) {
19160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19161 LDKQueryChannelRange orig_conv;
19162 orig_conv.inner = (void*)(orig & (~1));
19163 orig_conv.is_owned = false;
19164 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19165 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19166 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19167 uint64_t ret_ref = (uint64_t)ret_var.inner;
19168 if (ret_var.is_owned) {
19174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19175 LDKReplyChannelRange this_obj_conv;
19176 this_obj_conv.inner = (void*)(this_obj & (~1));
19177 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19178 ReplyChannelRange_free(this_obj_conv);
19181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19182 LDKReplyChannelRange this_ptr_conv;
19183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19184 this_ptr_conv.is_owned = false;
19185 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19186 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
19190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19191 LDKReplyChannelRange this_ptr_conv;
19192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19193 this_ptr_conv.is_owned = false;
19194 LDKThirtyTwoBytes val_ref;
19195 CHECK((*env)->GetArrayLength(env, val) == 32);
19196 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19197 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19200 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19201 LDKReplyChannelRange this_ptr_conv;
19202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19203 this_ptr_conv.is_owned = false;
19204 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
19208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19209 LDKReplyChannelRange this_ptr_conv;
19210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19211 this_ptr_conv.is_owned = false;
19212 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
19215 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19216 LDKReplyChannelRange this_ptr_conv;
19217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19218 this_ptr_conv.is_owned = false;
19219 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
19223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19224 LDKReplyChannelRange this_ptr_conv;
19225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19226 this_ptr_conv.is_owned = false;
19227 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
19231 LDKReplyChannelRange this_ptr_conv;
19232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19233 this_ptr_conv.is_owned = false;
19234 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
19238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19239 LDKReplyChannelRange this_ptr_conv;
19240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19241 this_ptr_conv.is_owned = false;
19242 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
19245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19246 LDKReplyChannelRange this_ptr_conv;
19247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19248 this_ptr_conv.is_owned = false;
19249 LDKCVec_u64Z val_constr;
19250 val_constr.datalen = (*env)->GetArrayLength(env, val);
19251 if (val_constr.datalen > 0)
19252 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19254 val_constr.data = NULL;
19255 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19256 for (size_t g = 0; g < val_constr.datalen; g++) {
19257 int64_t val_conv_6 = val_vals[g];
19258 val_constr.data[g] = val_conv_6;
19260 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19261 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
19264 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) {
19265 LDKThirtyTwoBytes chain_hash_arg_ref;
19266 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19267 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19268 LDKCVec_u64Z short_channel_ids_arg_constr;
19269 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19270 if (short_channel_ids_arg_constr.datalen > 0)
19271 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19273 short_channel_ids_arg_constr.data = NULL;
19274 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19275 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19276 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19277 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19279 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19280 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
19281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19283 uint64_t ret_ref = (uint64_t)ret_var.inner;
19284 if (ret_var.is_owned) {
19290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19291 LDKReplyChannelRange orig_conv;
19292 orig_conv.inner = (void*)(orig & (~1));
19293 orig_conv.is_owned = false;
19294 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
19295 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19296 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19297 uint64_t ret_ref = (uint64_t)ret_var.inner;
19298 if (ret_var.is_owned) {
19304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19305 LDKQueryShortChannelIds this_obj_conv;
19306 this_obj_conv.inner = (void*)(this_obj & (~1));
19307 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19308 QueryShortChannelIds_free(this_obj_conv);
19311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19312 LDKQueryShortChannelIds this_ptr_conv;
19313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19314 this_ptr_conv.is_owned = false;
19315 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19316 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
19320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19321 LDKQueryShortChannelIds this_ptr_conv;
19322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19323 this_ptr_conv.is_owned = false;
19324 LDKThirtyTwoBytes val_ref;
19325 CHECK((*env)->GetArrayLength(env, val) == 32);
19326 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19327 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
19330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19331 LDKQueryShortChannelIds this_ptr_conv;
19332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19333 this_ptr_conv.is_owned = false;
19334 LDKCVec_u64Z val_constr;
19335 val_constr.datalen = (*env)->GetArrayLength(env, val);
19336 if (val_constr.datalen > 0)
19337 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19339 val_constr.data = NULL;
19340 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19341 for (size_t g = 0; g < val_constr.datalen; g++) {
19342 int64_t val_conv_6 = val_vals[g];
19343 val_constr.data[g] = val_conv_6;
19345 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19346 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
19349 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) {
19350 LDKThirtyTwoBytes chain_hash_arg_ref;
19351 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19352 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19353 LDKCVec_u64Z short_channel_ids_arg_constr;
19354 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19355 if (short_channel_ids_arg_constr.datalen > 0)
19356 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19358 short_channel_ids_arg_constr.data = NULL;
19359 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19360 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19361 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19362 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19364 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19365 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
19366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19368 uint64_t ret_ref = (uint64_t)ret_var.inner;
19369 if (ret_var.is_owned) {
19375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19376 LDKQueryShortChannelIds orig_conv;
19377 orig_conv.inner = (void*)(orig & (~1));
19378 orig_conv.is_owned = false;
19379 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
19380 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19381 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19382 uint64_t ret_ref = (uint64_t)ret_var.inner;
19383 if (ret_var.is_owned) {
19389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19390 LDKReplyShortChannelIdsEnd this_obj_conv;
19391 this_obj_conv.inner = (void*)(this_obj & (~1));
19392 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19393 ReplyShortChannelIdsEnd_free(this_obj_conv);
19396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19397 LDKReplyShortChannelIdsEnd this_ptr_conv;
19398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19399 this_ptr_conv.is_owned = false;
19400 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19401 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
19405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19406 LDKReplyShortChannelIdsEnd this_ptr_conv;
19407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19408 this_ptr_conv.is_owned = false;
19409 LDKThirtyTwoBytes val_ref;
19410 CHECK((*env)->GetArrayLength(env, val) == 32);
19411 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19412 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
19415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
19416 LDKReplyShortChannelIdsEnd this_ptr_conv;
19417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19418 this_ptr_conv.is_owned = false;
19419 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
19423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19424 LDKReplyShortChannelIdsEnd this_ptr_conv;
19425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19426 this_ptr_conv.is_owned = false;
19427 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
19430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
19431 LDKThirtyTwoBytes chain_hash_arg_ref;
19432 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19433 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19434 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
19435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19437 uint64_t ret_ref = (uint64_t)ret_var.inner;
19438 if (ret_var.is_owned) {
19444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19445 LDKReplyShortChannelIdsEnd orig_conv;
19446 orig_conv.inner = (void*)(orig & (~1));
19447 orig_conv.is_owned = false;
19448 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
19449 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19450 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19451 uint64_t ret_ref = (uint64_t)ret_var.inner;
19452 if (ret_var.is_owned) {
19458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19459 LDKGossipTimestampFilter this_obj_conv;
19460 this_obj_conv.inner = (void*)(this_obj & (~1));
19461 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19462 GossipTimestampFilter_free(this_obj_conv);
19465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19466 LDKGossipTimestampFilter this_ptr_conv;
19467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19468 this_ptr_conv.is_owned = false;
19469 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19470 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
19474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19475 LDKGossipTimestampFilter this_ptr_conv;
19476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19477 this_ptr_conv.is_owned = false;
19478 LDKThirtyTwoBytes val_ref;
19479 CHECK((*env)->GetArrayLength(env, val) == 32);
19480 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19481 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
19484 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
19485 LDKGossipTimestampFilter this_ptr_conv;
19486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19487 this_ptr_conv.is_owned = false;
19488 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
19492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19493 LDKGossipTimestampFilter this_ptr_conv;
19494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19495 this_ptr_conv.is_owned = false;
19496 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
19499 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
19500 LDKGossipTimestampFilter this_ptr_conv;
19501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19502 this_ptr_conv.is_owned = false;
19503 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
19507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19508 LDKGossipTimestampFilter this_ptr_conv;
19509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19510 this_ptr_conv.is_owned = false;
19511 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
19514 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) {
19515 LDKThirtyTwoBytes chain_hash_arg_ref;
19516 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19517 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19518 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
19519 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19520 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19521 uint64_t ret_ref = (uint64_t)ret_var.inner;
19522 if (ret_var.is_owned) {
19528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19529 LDKGossipTimestampFilter orig_conv;
19530 orig_conv.inner = (void*)(orig & (~1));
19531 orig_conv.is_owned = false;
19532 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
19533 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19534 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19535 uint64_t ret_ref = (uint64_t)ret_var.inner;
19536 if (ret_var.is_owned) {
19542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19543 if ((this_ptr & 1) != 0) return;
19544 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
19545 FREE((void*)this_ptr);
19546 ErrorAction_free(this_ptr_conv);
19549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19550 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
19551 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19552 *ret_copy = ErrorAction_clone(orig_conv);
19553 uint64_t ret_ref = (uint64_t)ret_copy;
19557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19558 LDKLightningError this_obj_conv;
19559 this_obj_conv.inner = (void*)(this_obj & (~1));
19560 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19561 LightningError_free(this_obj_conv);
19564 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
19565 LDKLightningError this_ptr_conv;
19566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19567 this_ptr_conv.is_owned = false;
19568 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
19569 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
19574 LDKLightningError this_ptr_conv;
19575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19576 this_ptr_conv.is_owned = false;
19577 LDKStr val_conv = java_to_owned_str(env, val);
19578 LightningError_set_err(&this_ptr_conv, val_conv);
19581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
19582 LDKLightningError this_ptr_conv;
19583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19584 this_ptr_conv.is_owned = false;
19585 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19586 *ret_copy = LightningError_get_action(&this_ptr_conv);
19587 uint64_t ret_ref = (uint64_t)ret_copy;
19591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19592 LDKLightningError this_ptr_conv;
19593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19594 this_ptr_conv.is_owned = false;
19595 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
19596 LightningError_set_action(&this_ptr_conv, val_conv);
19599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
19600 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
19601 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
19602 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
19603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19605 uint64_t ret_ref = (uint64_t)ret_var.inner;
19606 if (ret_var.is_owned) {
19612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19613 LDKLightningError orig_conv;
19614 orig_conv.inner = (void*)(orig & (~1));
19615 orig_conv.is_owned = false;
19616 LDKLightningError ret_var = LightningError_clone(&orig_conv);
19617 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19618 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19619 uint64_t ret_ref = (uint64_t)ret_var.inner;
19620 if (ret_var.is_owned) {
19626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19627 LDKCommitmentUpdate this_obj_conv;
19628 this_obj_conv.inner = (void*)(this_obj & (~1));
19629 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19630 CommitmentUpdate_free(this_obj_conv);
19633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19634 LDKCommitmentUpdate this_ptr_conv;
19635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19636 this_ptr_conv.is_owned = false;
19637 LDKCVec_UpdateAddHTLCZ val_constr;
19638 val_constr.datalen = (*env)->GetArrayLength(env, val);
19639 if (val_constr.datalen > 0)
19640 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19642 val_constr.data = NULL;
19643 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19644 for (size_t p = 0; p < val_constr.datalen; p++) {
19645 int64_t val_conv_15 = val_vals[p];
19646 LDKUpdateAddHTLC val_conv_15_conv;
19647 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
19648 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
19649 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
19650 val_constr.data[p] = val_conv_15_conv;
19652 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19653 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
19656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19657 LDKCommitmentUpdate this_ptr_conv;
19658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19659 this_ptr_conv.is_owned = false;
19660 LDKCVec_UpdateFulfillHTLCZ val_constr;
19661 val_constr.datalen = (*env)->GetArrayLength(env, val);
19662 if (val_constr.datalen > 0)
19663 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19665 val_constr.data = NULL;
19666 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19667 for (size_t t = 0; t < val_constr.datalen; t++) {
19668 int64_t val_conv_19 = val_vals[t];
19669 LDKUpdateFulfillHTLC val_conv_19_conv;
19670 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
19671 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
19672 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
19673 val_constr.data[t] = val_conv_19_conv;
19675 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19676 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
19679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19680 LDKCommitmentUpdate this_ptr_conv;
19681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19682 this_ptr_conv.is_owned = false;
19683 LDKCVec_UpdateFailHTLCZ val_constr;
19684 val_constr.datalen = (*env)->GetArrayLength(env, val);
19685 if (val_constr.datalen > 0)
19686 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19688 val_constr.data = NULL;
19689 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19690 for (size_t q = 0; q < val_constr.datalen; q++) {
19691 int64_t val_conv_16 = val_vals[q];
19692 LDKUpdateFailHTLC val_conv_16_conv;
19693 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
19694 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
19695 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
19696 val_constr.data[q] = val_conv_16_conv;
19698 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19699 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
19702 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) {
19703 LDKCommitmentUpdate this_ptr_conv;
19704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19705 this_ptr_conv.is_owned = false;
19706 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
19707 val_constr.datalen = (*env)->GetArrayLength(env, val);
19708 if (val_constr.datalen > 0)
19709 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19711 val_constr.data = NULL;
19712 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19713 for (size_t z = 0; z < val_constr.datalen; z++) {
19714 int64_t val_conv_25 = val_vals[z];
19715 LDKUpdateFailMalformedHTLC val_conv_25_conv;
19716 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
19717 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
19718 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
19719 val_constr.data[z] = val_conv_25_conv;
19721 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19722 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
19725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
19726 LDKCommitmentUpdate this_ptr_conv;
19727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19728 this_ptr_conv.is_owned = false;
19729 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
19730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19732 uint64_t ret_ref = (uint64_t)ret_var.inner;
19733 if (ret_var.is_owned) {
19739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19740 LDKCommitmentUpdate this_ptr_conv;
19741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19742 this_ptr_conv.is_owned = false;
19743 LDKUpdateFee val_conv;
19744 val_conv.inner = (void*)(val & (~1));
19745 val_conv.is_owned = (val & 1) || (val == 0);
19746 val_conv = UpdateFee_clone(&val_conv);
19747 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
19750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
19751 LDKCommitmentUpdate this_ptr_conv;
19752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19753 this_ptr_conv.is_owned = false;
19754 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
19755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19757 uint64_t ret_ref = (uint64_t)ret_var.inner;
19758 if (ret_var.is_owned) {
19764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19765 LDKCommitmentUpdate this_ptr_conv;
19766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19767 this_ptr_conv.is_owned = false;
19768 LDKCommitmentSigned val_conv;
19769 val_conv.inner = (void*)(val & (~1));
19770 val_conv.is_owned = (val & 1) || (val == 0);
19771 val_conv = CommitmentSigned_clone(&val_conv);
19772 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
19775 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) {
19776 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
19777 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
19778 if (update_add_htlcs_arg_constr.datalen > 0)
19779 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19781 update_add_htlcs_arg_constr.data = NULL;
19782 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
19783 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
19784 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
19785 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
19786 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
19787 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
19788 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
19789 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
19791 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
19792 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
19793 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
19794 if (update_fulfill_htlcs_arg_constr.datalen > 0)
19795 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19797 update_fulfill_htlcs_arg_constr.data = NULL;
19798 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
19799 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
19800 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
19801 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
19802 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
19803 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
19804 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
19805 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
19807 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
19808 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
19809 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
19810 if (update_fail_htlcs_arg_constr.datalen > 0)
19811 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19813 update_fail_htlcs_arg_constr.data = NULL;
19814 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
19815 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
19816 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
19817 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
19818 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
19819 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
19820 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
19821 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
19823 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
19824 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
19825 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
19826 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
19827 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19829 update_fail_malformed_htlcs_arg_constr.data = NULL;
19830 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
19831 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
19832 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
19833 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
19834 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
19835 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);
19836 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
19837 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
19839 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
19840 LDKUpdateFee update_fee_arg_conv;
19841 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
19842 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
19843 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
19844 LDKCommitmentSigned commitment_signed_arg_conv;
19845 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
19846 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
19847 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
19848 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);
19849 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19850 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19851 uint64_t ret_ref = (uint64_t)ret_var.inner;
19852 if (ret_var.is_owned) {
19858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19859 LDKCommitmentUpdate orig_conv;
19860 orig_conv.inner = (void*)(orig & (~1));
19861 orig_conv.is_owned = false;
19862 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
19863 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19864 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19865 uint64_t ret_ref = (uint64_t)ret_var.inner;
19866 if (ret_var.is_owned) {
19872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19873 if ((this_ptr & 1) != 0) return;
19874 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
19875 FREE((void*)this_ptr);
19876 HTLCFailChannelUpdate_free(this_ptr_conv);
19879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19880 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
19881 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
19882 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
19883 uint64_t ret_ref = (uint64_t)ret_copy;
19887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19888 if ((this_ptr & 1) != 0) return;
19889 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
19890 FREE((void*)this_ptr);
19891 ChannelMessageHandler_free(this_ptr_conv);
19894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19895 if ((this_ptr & 1) != 0) return;
19896 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
19897 FREE((void*)this_ptr);
19898 RoutingMessageHandler_free(this_ptr_conv);
19901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
19902 LDKAcceptChannel obj_conv;
19903 obj_conv.inner = (void*)(obj & (~1));
19904 obj_conv.is_owned = false;
19905 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
19906 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19907 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19908 CVec_u8Z_free(ret_var);
19912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19913 LDKu8slice ser_ref;
19914 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19915 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19916 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19917 *ret_conv = AcceptChannel_read(ser_ref);
19918 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19919 return (uint64_t)ret_conv;
19922 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
19923 LDKAnnouncementSignatures obj_conv;
19924 obj_conv.inner = (void*)(obj & (~1));
19925 obj_conv.is_owned = false;
19926 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
19927 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19928 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19929 CVec_u8Z_free(ret_var);
19933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19934 LDKu8slice ser_ref;
19935 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19936 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19937 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19938 *ret_conv = AnnouncementSignatures_read(ser_ref);
19939 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19940 return (uint64_t)ret_conv;
19943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
19944 LDKChannelReestablish obj_conv;
19945 obj_conv.inner = (void*)(obj & (~1));
19946 obj_conv.is_owned = false;
19947 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
19948 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19949 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19950 CVec_u8Z_free(ret_var);
19954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19955 LDKu8slice ser_ref;
19956 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19957 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19958 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19959 *ret_conv = ChannelReestablish_read(ser_ref);
19960 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19961 return (uint64_t)ret_conv;
19964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
19965 LDKClosingSigned obj_conv;
19966 obj_conv.inner = (void*)(obj & (~1));
19967 obj_conv.is_owned = false;
19968 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
19969 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19970 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19971 CVec_u8Z_free(ret_var);
19975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19976 LDKu8slice ser_ref;
19977 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19978 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19979 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19980 *ret_conv = ClosingSigned_read(ser_ref);
19981 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19982 return (uint64_t)ret_conv;
19985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
19986 LDKCommitmentSigned obj_conv;
19987 obj_conv.inner = (void*)(obj & (~1));
19988 obj_conv.is_owned = false;
19989 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
19990 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19991 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19992 CVec_u8Z_free(ret_var);
19996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19997 LDKu8slice ser_ref;
19998 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19999 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20000 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20001 *ret_conv = CommitmentSigned_read(ser_ref);
20002 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20003 return (uint64_t)ret_conv;
20006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
20007 LDKFundingCreated obj_conv;
20008 obj_conv.inner = (void*)(obj & (~1));
20009 obj_conv.is_owned = false;
20010 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20011 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20012 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20013 CVec_u8Z_free(ret_var);
20017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20018 LDKu8slice ser_ref;
20019 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20020 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20021 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20022 *ret_conv = FundingCreated_read(ser_ref);
20023 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20024 return (uint64_t)ret_conv;
20027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20028 LDKFundingSigned obj_conv;
20029 obj_conv.inner = (void*)(obj & (~1));
20030 obj_conv.is_owned = false;
20031 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20032 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20033 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20034 CVec_u8Z_free(ret_var);
20038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20039 LDKu8slice ser_ref;
20040 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20041 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20042 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20043 *ret_conv = FundingSigned_read(ser_ref);
20044 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20045 return (uint64_t)ret_conv;
20048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
20049 LDKFundingLocked obj_conv;
20050 obj_conv.inner = (void*)(obj & (~1));
20051 obj_conv.is_owned = false;
20052 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20053 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20054 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20055 CVec_u8Z_free(ret_var);
20059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20060 LDKu8slice ser_ref;
20061 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20062 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20063 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20064 *ret_conv = FundingLocked_read(ser_ref);
20065 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20066 return (uint64_t)ret_conv;
20069 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
20071 obj_conv.inner = (void*)(obj & (~1));
20072 obj_conv.is_owned = false;
20073 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
20074 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20075 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20076 CVec_u8Z_free(ret_var);
20080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20081 LDKu8slice ser_ref;
20082 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20083 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20084 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20085 *ret_conv = Init_read(ser_ref);
20086 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20087 return (uint64_t)ret_conv;
20090 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
20091 LDKOpenChannel obj_conv;
20092 obj_conv.inner = (void*)(obj & (~1));
20093 obj_conv.is_owned = false;
20094 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
20095 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20096 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20097 CVec_u8Z_free(ret_var);
20101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20102 LDKu8slice ser_ref;
20103 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20104 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20105 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20106 *ret_conv = OpenChannel_read(ser_ref);
20107 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20108 return (uint64_t)ret_conv;
20111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
20112 LDKRevokeAndACK obj_conv;
20113 obj_conv.inner = (void*)(obj & (~1));
20114 obj_conv.is_owned = false;
20115 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
20116 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20117 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20118 CVec_u8Z_free(ret_var);
20122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20123 LDKu8slice ser_ref;
20124 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20125 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20126 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20127 *ret_conv = RevokeAndACK_read(ser_ref);
20128 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20129 return (uint64_t)ret_conv;
20132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
20133 LDKShutdown obj_conv;
20134 obj_conv.inner = (void*)(obj & (~1));
20135 obj_conv.is_owned = false;
20136 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
20137 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20138 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20139 CVec_u8Z_free(ret_var);
20143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20144 LDKu8slice ser_ref;
20145 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20146 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20147 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20148 *ret_conv = Shutdown_read(ser_ref);
20149 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20150 return (uint64_t)ret_conv;
20153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20154 LDKUpdateFailHTLC obj_conv;
20155 obj_conv.inner = (void*)(obj & (~1));
20156 obj_conv.is_owned = false;
20157 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
20158 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20159 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20160 CVec_u8Z_free(ret_var);
20164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20165 LDKu8slice ser_ref;
20166 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20167 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20168 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20169 *ret_conv = UpdateFailHTLC_read(ser_ref);
20170 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20171 return (uint64_t)ret_conv;
20174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20175 LDKUpdateFailMalformedHTLC obj_conv;
20176 obj_conv.inner = (void*)(obj & (~1));
20177 obj_conv.is_owned = false;
20178 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
20179 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20180 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20181 CVec_u8Z_free(ret_var);
20185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20186 LDKu8slice ser_ref;
20187 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20188 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20189 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20190 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
20191 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20192 return (uint64_t)ret_conv;
20195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
20196 LDKUpdateFee obj_conv;
20197 obj_conv.inner = (void*)(obj & (~1));
20198 obj_conv.is_owned = false;
20199 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
20200 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20201 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20202 CVec_u8Z_free(ret_var);
20206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20207 LDKu8slice ser_ref;
20208 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20209 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20210 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20211 *ret_conv = UpdateFee_read(ser_ref);
20212 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20213 return (uint64_t)ret_conv;
20216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20217 LDKUpdateFulfillHTLC obj_conv;
20218 obj_conv.inner = (void*)(obj & (~1));
20219 obj_conv.is_owned = false;
20220 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
20221 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20222 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20223 CVec_u8Z_free(ret_var);
20227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20228 LDKu8slice ser_ref;
20229 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20230 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20231 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20232 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
20233 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20234 return (uint64_t)ret_conv;
20237 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20238 LDKUpdateAddHTLC obj_conv;
20239 obj_conv.inner = (void*)(obj & (~1));
20240 obj_conv.is_owned = false;
20241 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
20242 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20243 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20244 CVec_u8Z_free(ret_var);
20248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20249 LDKu8slice ser_ref;
20250 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20251 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20252 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20253 *ret_conv = UpdateAddHTLC_read(ser_ref);
20254 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20255 return (uint64_t)ret_conv;
20258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
20260 obj_conv.inner = (void*)(obj & (~1));
20261 obj_conv.is_owned = false;
20262 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
20263 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20264 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20265 CVec_u8Z_free(ret_var);
20269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20270 LDKu8slice ser_ref;
20271 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20272 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20273 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20274 *ret_conv = Ping_read(ser_ref);
20275 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20276 return (uint64_t)ret_conv;
20279 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
20281 obj_conv.inner = (void*)(obj & (~1));
20282 obj_conv.is_owned = false;
20283 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
20284 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20285 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20286 CVec_u8Z_free(ret_var);
20290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20291 LDKu8slice ser_ref;
20292 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20293 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20294 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20295 *ret_conv = Pong_read(ser_ref);
20296 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20297 return (uint64_t)ret_conv;
20300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20301 LDKUnsignedChannelAnnouncement obj_conv;
20302 obj_conv.inner = (void*)(obj & (~1));
20303 obj_conv.is_owned = false;
20304 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
20305 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20306 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20307 CVec_u8Z_free(ret_var);
20311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20312 LDKu8slice ser_ref;
20313 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20314 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20315 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20316 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
20317 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20318 return (uint64_t)ret_conv;
20321 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20322 LDKChannelAnnouncement obj_conv;
20323 obj_conv.inner = (void*)(obj & (~1));
20324 obj_conv.is_owned = false;
20325 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
20326 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20327 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20328 CVec_u8Z_free(ret_var);
20332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20333 LDKu8slice ser_ref;
20334 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20335 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20336 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20337 *ret_conv = ChannelAnnouncement_read(ser_ref);
20338 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20339 return (uint64_t)ret_conv;
20342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20343 LDKUnsignedChannelUpdate obj_conv;
20344 obj_conv.inner = (void*)(obj & (~1));
20345 obj_conv.is_owned = false;
20346 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
20347 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20348 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20349 CVec_u8Z_free(ret_var);
20353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20354 LDKu8slice ser_ref;
20355 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20356 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20357 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20358 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
20359 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20360 return (uint64_t)ret_conv;
20363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20364 LDKChannelUpdate obj_conv;
20365 obj_conv.inner = (void*)(obj & (~1));
20366 obj_conv.is_owned = false;
20367 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
20368 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20369 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20370 CVec_u8Z_free(ret_var);
20374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20375 LDKu8slice ser_ref;
20376 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20377 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20378 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20379 *ret_conv = ChannelUpdate_read(ser_ref);
20380 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20381 return (uint64_t)ret_conv;
20384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
20385 LDKErrorMessage obj_conv;
20386 obj_conv.inner = (void*)(obj & (~1));
20387 obj_conv.is_owned = false;
20388 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
20389 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20390 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20391 CVec_u8Z_free(ret_var);
20395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20396 LDKu8slice ser_ref;
20397 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20398 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20399 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20400 *ret_conv = ErrorMessage_read(ser_ref);
20401 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20402 return (uint64_t)ret_conv;
20405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20406 LDKUnsignedNodeAnnouncement obj_conv;
20407 obj_conv.inner = (void*)(obj & (~1));
20408 obj_conv.is_owned = false;
20409 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
20410 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20411 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20412 CVec_u8Z_free(ret_var);
20416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20417 LDKu8slice ser_ref;
20418 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20419 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20420 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20421 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
20422 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20423 return (uint64_t)ret_conv;
20426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20427 LDKNodeAnnouncement obj_conv;
20428 obj_conv.inner = (void*)(obj & (~1));
20429 obj_conv.is_owned = false;
20430 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
20431 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20432 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20433 CVec_u8Z_free(ret_var);
20437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20438 LDKu8slice ser_ref;
20439 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20440 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20441 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20442 *ret_conv = NodeAnnouncement_read(ser_ref);
20443 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20444 return (uint64_t)ret_conv;
20447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20448 LDKu8slice ser_ref;
20449 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20450 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20451 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20452 *ret_conv = QueryShortChannelIds_read(ser_ref);
20453 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20454 return (uint64_t)ret_conv;
20457 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
20458 LDKQueryShortChannelIds obj_conv;
20459 obj_conv.inner = (void*)(obj & (~1));
20460 obj_conv.is_owned = false;
20461 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
20462 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20463 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20464 CVec_u8Z_free(ret_var);
20468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20469 LDKu8slice ser_ref;
20470 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20471 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20472 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20473 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
20474 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20475 return (uint64_t)ret_conv;
20478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
20479 LDKReplyShortChannelIdsEnd obj_conv;
20480 obj_conv.inner = (void*)(obj & (~1));
20481 obj_conv.is_owned = false;
20482 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
20483 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20484 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20485 CVec_u8Z_free(ret_var);
20489 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
20490 LDKQueryChannelRange this_arg_conv;
20491 this_arg_conv.inner = (void*)(this_arg & (~1));
20492 this_arg_conv.is_owned = false;
20493 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
20497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20498 LDKu8slice ser_ref;
20499 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20500 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20501 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20502 *ret_conv = QueryChannelRange_read(ser_ref);
20503 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20504 return (uint64_t)ret_conv;
20507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20508 LDKQueryChannelRange obj_conv;
20509 obj_conv.inner = (void*)(obj & (~1));
20510 obj_conv.is_owned = false;
20511 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
20512 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20513 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20514 CVec_u8Z_free(ret_var);
20518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20519 LDKu8slice ser_ref;
20520 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20521 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20522 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20523 *ret_conv = ReplyChannelRange_read(ser_ref);
20524 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20525 return (uint64_t)ret_conv;
20528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20529 LDKReplyChannelRange obj_conv;
20530 obj_conv.inner = (void*)(obj & (~1));
20531 obj_conv.is_owned = false;
20532 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
20533 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20534 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20535 CVec_u8Z_free(ret_var);
20539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20540 LDKu8slice ser_ref;
20541 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20542 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20543 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20544 *ret_conv = GossipTimestampFilter_read(ser_ref);
20545 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20546 return (uint64_t)ret_conv;
20549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
20550 LDKGossipTimestampFilter obj_conv;
20551 obj_conv.inner = (void*)(obj & (~1));
20552 obj_conv.is_owned = false;
20553 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
20554 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20555 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20556 CVec_u8Z_free(ret_var);
20560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20561 LDKIgnoringMessageHandler this_obj_conv;
20562 this_obj_conv.inner = (void*)(this_obj & (~1));
20563 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20564 IgnoringMessageHandler_free(this_obj_conv);
20567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
20568 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
20569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20571 uint64_t ret_ref = (uint64_t)ret_var.inner;
20572 if (ret_var.is_owned) {
20578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20579 LDKIgnoringMessageHandler this_arg_conv;
20580 this_arg_conv.inner = (void*)(this_arg & (~1));
20581 this_arg_conv.is_owned = false;
20582 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20583 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20584 return (uint64_t)ret;
20587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20588 LDKIgnoringMessageHandler this_arg_conv;
20589 this_arg_conv.inner = (void*)(this_arg & (~1));
20590 this_arg_conv.is_owned = false;
20591 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
20592 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
20593 return (uint64_t)ret;
20596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20597 LDKErroringMessageHandler this_obj_conv;
20598 this_obj_conv.inner = (void*)(this_obj & (~1));
20599 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20600 ErroringMessageHandler_free(this_obj_conv);
20603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
20604 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
20605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20607 uint64_t ret_ref = (uint64_t)ret_var.inner;
20608 if (ret_var.is_owned) {
20614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20615 LDKErroringMessageHandler this_arg_conv;
20616 this_arg_conv.inner = (void*)(this_arg & (~1));
20617 this_arg_conv.is_owned = false;
20618 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20619 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20620 return (uint64_t)ret;
20623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20624 LDKErroringMessageHandler this_arg_conv;
20625 this_arg_conv.inner = (void*)(this_arg & (~1));
20626 this_arg_conv.is_owned = false;
20627 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20628 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
20629 return (uint64_t)ret;
20632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20633 LDKMessageHandler this_obj_conv;
20634 this_obj_conv.inner = (void*)(this_obj & (~1));
20635 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20636 MessageHandler_free(this_obj_conv);
20639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20640 LDKMessageHandler this_ptr_conv;
20641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20642 this_ptr_conv.is_owned = false;
20643 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
20647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20648 LDKMessageHandler this_ptr_conv;
20649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20650 this_ptr_conv.is_owned = false;
20651 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
20652 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
20653 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20654 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
20656 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
20659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20660 LDKMessageHandler this_ptr_conv;
20661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20662 this_ptr_conv.is_owned = false;
20663 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
20667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20668 LDKMessageHandler this_ptr_conv;
20669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20670 this_ptr_conv.is_owned = false;
20671 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
20672 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20673 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20674 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
20676 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
20679 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) {
20680 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
20681 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
20682 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20683 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
20685 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
20686 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20687 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20688 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
20690 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
20691 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20692 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20693 uint64_t ret_ref = (uint64_t)ret_var.inner;
20694 if (ret_var.is_owned) {
20700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20701 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
20702 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
20703 *ret = SocketDescriptor_clone(orig_conv);
20704 return (uint64_t)ret;
20707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20708 if ((this_ptr & 1) != 0) return;
20709 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
20710 FREE((void*)this_ptr);
20711 SocketDescriptor_free(this_ptr_conv);
20714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20715 LDKPeerHandleError this_obj_conv;
20716 this_obj_conv.inner = (void*)(this_obj & (~1));
20717 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20718 PeerHandleError_free(this_obj_conv);
20721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
20722 LDKPeerHandleError this_ptr_conv;
20723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20724 this_ptr_conv.is_owned = false;
20725 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
20729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
20730 LDKPeerHandleError this_ptr_conv;
20731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20732 this_ptr_conv.is_owned = false;
20733 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
20736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
20737 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
20738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20740 uint64_t ret_ref = (uint64_t)ret_var.inner;
20741 if (ret_var.is_owned) {
20747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20748 LDKPeerHandleError orig_conv;
20749 orig_conv.inner = (void*)(orig & (~1));
20750 orig_conv.is_owned = false;
20751 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
20752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20754 uint64_t ret_ref = (uint64_t)ret_var.inner;
20755 if (ret_var.is_owned) {
20761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20762 LDKPeerManager this_obj_conv;
20763 this_obj_conv.inner = (void*)(this_obj & (~1));
20764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20765 PeerManager_free(this_obj_conv);
20768 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) {
20769 LDKMessageHandler message_handler_conv;
20770 message_handler_conv.inner = (void*)(message_handler & (~1));
20771 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
20772 // Warning: we need a move here but no clone is available for LDKMessageHandler
20773 LDKSecretKey our_node_secret_ref;
20774 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
20775 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
20776 unsigned char ephemeral_random_data_arr[32];
20777 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
20778 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
20779 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
20780 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
20781 if (logger_conv.free == LDKLogger_JCalls_free) {
20782 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20783 LDKLogger_JCalls_clone(logger_conv.this_arg);
20785 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
20786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20788 uint64_t ret_ref = (uint64_t)ret_var.inner;
20789 if (ret_var.is_owned) {
20795 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
20796 LDKPeerManager this_arg_conv;
20797 this_arg_conv.inner = (void*)(this_arg & (~1));
20798 this_arg_conv.is_owned = false;
20799 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
20800 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
20802 for (size_t i = 0; i < ret_var.datalen; i++) {
20803 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
20804 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
20805 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
20807 FREE(ret_var.data);
20811 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) {
20812 LDKPeerManager this_arg_conv;
20813 this_arg_conv.inner = (void*)(this_arg & (~1));
20814 this_arg_conv.is_owned = false;
20815 LDKPublicKey their_node_id_ref;
20816 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20817 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20818 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20819 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
20820 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20821 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
20823 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20824 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
20825 return (uint64_t)ret_conv;
20828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
20829 LDKPeerManager this_arg_conv;
20830 this_arg_conv.inner = (void*)(this_arg & (~1));
20831 this_arg_conv.is_owned = false;
20832 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20833 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
20834 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20835 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
20837 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20838 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
20839 return (uint64_t)ret_conv;
20842 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) {
20843 LDKPeerManager this_arg_conv;
20844 this_arg_conv.inner = (void*)(this_arg & (~1));
20845 this_arg_conv.is_owned = false;
20846 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20847 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20848 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
20849 return (uint64_t)ret_conv;
20852 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) {
20853 LDKPeerManager this_arg_conv;
20854 this_arg_conv.inner = (void*)(this_arg & (~1));
20855 this_arg_conv.is_owned = false;
20856 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
20857 LDKu8slice data_ref;
20858 data_ref.datalen = (*env)->GetArrayLength(env, data);
20859 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
20860 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20861 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
20862 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
20863 return (uint64_t)ret_conv;
20866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
20867 LDKPeerManager this_arg_conv;
20868 this_arg_conv.inner = (void*)(this_arg & (~1));
20869 this_arg_conv.is_owned = false;
20870 PeerManager_process_events(&this_arg_conv);
20873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
20874 LDKPeerManager this_arg_conv;
20875 this_arg_conv.inner = (void*)(this_arg & (~1));
20876 this_arg_conv.is_owned = false;
20877 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20878 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
20881 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) {
20882 LDKPeerManager this_arg_conv;
20883 this_arg_conv.inner = (void*)(this_arg & (~1));
20884 this_arg_conv.is_owned = false;
20885 LDKPublicKey node_id_ref;
20886 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20887 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20888 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
20891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
20892 LDKPeerManager this_arg_conv;
20893 this_arg_conv.inner = (void*)(this_arg & (~1));
20894 this_arg_conv.is_owned = false;
20895 PeerManager_timer_tick_occurred(&this_arg_conv);
20898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
20899 unsigned char commitment_seed_arr[32];
20900 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
20901 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
20902 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
20903 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20904 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
20908 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) {
20909 LDKPublicKey per_commitment_point_ref;
20910 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20911 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20912 unsigned char base_secret_arr[32];
20913 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
20914 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
20915 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
20916 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
20917 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
20918 return (uint64_t)ret_conv;
20921 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) {
20922 LDKPublicKey per_commitment_point_ref;
20923 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20924 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20925 LDKPublicKey base_point_ref;
20926 CHECK((*env)->GetArrayLength(env, base_point) == 33);
20927 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
20928 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20929 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
20930 return (uint64_t)ret_conv;
20933 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) {
20934 unsigned char per_commitment_secret_arr[32];
20935 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
20936 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
20937 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
20938 unsigned char countersignatory_revocation_base_secret_arr[32];
20939 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
20940 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
20941 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
20942 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
20943 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
20944 return (uint64_t)ret_conv;
20947 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) {
20948 LDKPublicKey per_commitment_point_ref;
20949 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20950 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20951 LDKPublicKey countersignatory_revocation_base_point_ref;
20952 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
20953 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
20954 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20955 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
20956 return (uint64_t)ret_conv;
20959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20960 LDKTxCreationKeys this_obj_conv;
20961 this_obj_conv.inner = (void*)(this_obj & (~1));
20962 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20963 TxCreationKeys_free(this_obj_conv);
20966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20967 LDKTxCreationKeys this_ptr_conv;
20968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20969 this_ptr_conv.is_owned = false;
20970 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20971 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
20975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20976 LDKTxCreationKeys this_ptr_conv;
20977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20978 this_ptr_conv.is_owned = false;
20979 LDKPublicKey val_ref;
20980 CHECK((*env)->GetArrayLength(env, val) == 33);
20981 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20982 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
20985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
20986 LDKTxCreationKeys this_ptr_conv;
20987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20988 this_ptr_conv.is_owned = false;
20989 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20990 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
20994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20995 LDKTxCreationKeys this_ptr_conv;
20996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20997 this_ptr_conv.is_owned = false;
20998 LDKPublicKey val_ref;
20999 CHECK((*env)->GetArrayLength(env, val) == 33);
21000 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21001 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21005 LDKTxCreationKeys this_ptr_conv;
21006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21007 this_ptr_conv.is_owned = false;
21008 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21009 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
21013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21014 LDKTxCreationKeys this_ptr_conv;
21015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21016 this_ptr_conv.is_owned = false;
21017 LDKPublicKey val_ref;
21018 CHECK((*env)->GetArrayLength(env, val) == 33);
21019 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21020 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21024 LDKTxCreationKeys this_ptr_conv;
21025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21026 this_ptr_conv.is_owned = false;
21027 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21028 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
21032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21033 LDKTxCreationKeys this_ptr_conv;
21034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21035 this_ptr_conv.is_owned = false;
21036 LDKPublicKey val_ref;
21037 CHECK((*env)->GetArrayLength(env, val) == 33);
21038 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21039 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21043 LDKTxCreationKeys this_ptr_conv;
21044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21045 this_ptr_conv.is_owned = false;
21046 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21047 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
21051 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) {
21052 LDKTxCreationKeys this_ptr_conv;
21053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21054 this_ptr_conv.is_owned = false;
21055 LDKPublicKey val_ref;
21056 CHECK((*env)->GetArrayLength(env, val) == 33);
21057 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21058 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21061 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) {
21062 LDKPublicKey per_commitment_point_arg_ref;
21063 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
21064 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
21065 LDKPublicKey revocation_key_arg_ref;
21066 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
21067 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
21068 LDKPublicKey broadcaster_htlc_key_arg_ref;
21069 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
21070 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
21071 LDKPublicKey countersignatory_htlc_key_arg_ref;
21072 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
21073 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
21074 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21075 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
21076 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
21077 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);
21078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21080 uint64_t ret_ref = (uint64_t)ret_var.inner;
21081 if (ret_var.is_owned) {
21087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21088 LDKTxCreationKeys orig_conv;
21089 orig_conv.inner = (void*)(orig & (~1));
21090 orig_conv.is_owned = false;
21091 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
21092 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21093 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21094 uint64_t ret_ref = (uint64_t)ret_var.inner;
21095 if (ret_var.is_owned) {
21101 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21102 LDKTxCreationKeys obj_conv;
21103 obj_conv.inner = (void*)(obj & (~1));
21104 obj_conv.is_owned = false;
21105 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
21106 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21107 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21108 CVec_u8Z_free(ret_var);
21112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21113 LDKu8slice ser_ref;
21114 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21115 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21116 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
21117 *ret_conv = TxCreationKeys_read(ser_ref);
21118 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21119 return (uint64_t)ret_conv;
21122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21123 LDKChannelPublicKeys this_obj_conv;
21124 this_obj_conv.inner = (void*)(this_obj & (~1));
21125 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21126 ChannelPublicKeys_free(this_obj_conv);
21129 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21130 LDKChannelPublicKeys this_ptr_conv;
21131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21132 this_ptr_conv.is_owned = false;
21133 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21134 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
21138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21139 LDKChannelPublicKeys this_ptr_conv;
21140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21141 this_ptr_conv.is_owned = false;
21142 LDKPublicKey val_ref;
21143 CHECK((*env)->GetArrayLength(env, val) == 33);
21144 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21145 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
21148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21149 LDKChannelPublicKeys this_ptr_conv;
21150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21151 this_ptr_conv.is_owned = false;
21152 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21153 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
21157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21158 LDKChannelPublicKeys this_ptr_conv;
21159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21160 this_ptr_conv.is_owned = false;
21161 LDKPublicKey val_ref;
21162 CHECK((*env)->GetArrayLength(env, val) == 33);
21163 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21164 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
21167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21168 LDKChannelPublicKeys this_ptr_conv;
21169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21170 this_ptr_conv.is_owned = false;
21171 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21172 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
21176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21177 LDKChannelPublicKeys this_ptr_conv;
21178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21179 this_ptr_conv.is_owned = false;
21180 LDKPublicKey val_ref;
21181 CHECK((*env)->GetArrayLength(env, val) == 33);
21182 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21183 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
21186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21187 LDKChannelPublicKeys this_ptr_conv;
21188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21189 this_ptr_conv.is_owned = false;
21190 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21191 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
21195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21196 LDKChannelPublicKeys this_ptr_conv;
21197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21198 this_ptr_conv.is_owned = false;
21199 LDKPublicKey val_ref;
21200 CHECK((*env)->GetArrayLength(env, val) == 33);
21201 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21202 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21206 LDKChannelPublicKeys this_ptr_conv;
21207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21208 this_ptr_conv.is_owned = false;
21209 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21210 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
21214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21215 LDKChannelPublicKeys this_ptr_conv;
21216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21217 this_ptr_conv.is_owned = false;
21218 LDKPublicKey val_ref;
21219 CHECK((*env)->GetArrayLength(env, val) == 33);
21220 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21221 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
21224 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) {
21225 LDKPublicKey funding_pubkey_arg_ref;
21226 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
21227 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
21228 LDKPublicKey revocation_basepoint_arg_ref;
21229 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
21230 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
21231 LDKPublicKey payment_point_arg_ref;
21232 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
21233 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
21234 LDKPublicKey delayed_payment_basepoint_arg_ref;
21235 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
21236 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
21237 LDKPublicKey htlc_basepoint_arg_ref;
21238 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
21239 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
21240 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);
21241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21243 uint64_t ret_ref = (uint64_t)ret_var.inner;
21244 if (ret_var.is_owned) {
21250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21251 LDKChannelPublicKeys orig_conv;
21252 orig_conv.inner = (void*)(orig & (~1));
21253 orig_conv.is_owned = false;
21254 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
21255 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21256 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21257 uint64_t ret_ref = (uint64_t)ret_var.inner;
21258 if (ret_var.is_owned) {
21264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21265 LDKChannelPublicKeys obj_conv;
21266 obj_conv.inner = (void*)(obj & (~1));
21267 obj_conv.is_owned = false;
21268 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
21269 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21270 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21271 CVec_u8Z_free(ret_var);
21275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21276 LDKu8slice ser_ref;
21277 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21278 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21279 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
21280 *ret_conv = ChannelPublicKeys_read(ser_ref);
21281 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21282 return (uint64_t)ret_conv;
21285 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) {
21286 LDKPublicKey per_commitment_point_ref;
21287 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21288 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21289 LDKPublicKey broadcaster_delayed_payment_base_ref;
21290 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
21291 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
21292 LDKPublicKey broadcaster_htlc_base_ref;
21293 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
21294 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
21295 LDKPublicKey countersignatory_revocation_base_ref;
21296 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
21297 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
21298 LDKPublicKey countersignatory_htlc_base_ref;
21299 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
21300 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
21301 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21302 *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);
21303 return (uint64_t)ret_conv;
21306 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) {
21307 LDKPublicKey per_commitment_point_ref;
21308 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21309 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21310 LDKChannelPublicKeys broadcaster_keys_conv;
21311 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
21312 broadcaster_keys_conv.is_owned = false;
21313 LDKChannelPublicKeys countersignatory_keys_conv;
21314 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
21315 countersignatory_keys_conv.is_owned = false;
21316 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21317 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
21318 return (uint64_t)ret_conv;
21321 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) {
21322 LDKPublicKey revocation_key_ref;
21323 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21324 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21325 LDKPublicKey broadcaster_delayed_payment_key_ref;
21326 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21327 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21328 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
21329 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21330 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21331 CVec_u8Z_free(ret_var);
21335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21336 LDKHTLCOutputInCommitment this_obj_conv;
21337 this_obj_conv.inner = (void*)(this_obj & (~1));
21338 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21339 HTLCOutputInCommitment_free(this_obj_conv);
21342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
21343 LDKHTLCOutputInCommitment this_ptr_conv;
21344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21345 this_ptr_conv.is_owned = false;
21346 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
21350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21351 LDKHTLCOutputInCommitment this_ptr_conv;
21352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21353 this_ptr_conv.is_owned = false;
21354 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
21357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21358 LDKHTLCOutputInCommitment this_ptr_conv;
21359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21360 this_ptr_conv.is_owned = false;
21361 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
21365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21366 LDKHTLCOutputInCommitment this_ptr_conv;
21367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21368 this_ptr_conv.is_owned = false;
21369 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
21372 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
21373 LDKHTLCOutputInCommitment this_ptr_conv;
21374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21375 this_ptr_conv.is_owned = false;
21376 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
21380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21381 LDKHTLCOutputInCommitment this_ptr_conv;
21382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21383 this_ptr_conv.is_owned = false;
21384 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
21387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21388 LDKHTLCOutputInCommitment this_ptr_conv;
21389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21390 this_ptr_conv.is_owned = false;
21391 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21392 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
21396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21397 LDKHTLCOutputInCommitment this_ptr_conv;
21398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21399 this_ptr_conv.is_owned = false;
21400 LDKThirtyTwoBytes val_ref;
21401 CHECK((*env)->GetArrayLength(env, val) == 32);
21402 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21403 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
21406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
21407 LDKHTLCOutputInCommitment this_ptr_conv;
21408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21409 this_ptr_conv.is_owned = false;
21410 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21411 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
21412 uint64_t ret_ref = (uint64_t)ret_copy;
21416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21417 LDKHTLCOutputInCommitment this_ptr_conv;
21418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21419 this_ptr_conv.is_owned = false;
21420 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
21421 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
21424 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) {
21425 LDKThirtyTwoBytes payment_hash_arg_ref;
21426 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
21427 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
21428 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
21429 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
21430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21432 uint64_t ret_ref = (uint64_t)ret_var.inner;
21433 if (ret_var.is_owned) {
21439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21440 LDKHTLCOutputInCommitment orig_conv;
21441 orig_conv.inner = (void*)(orig & (~1));
21442 orig_conv.is_owned = false;
21443 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
21444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21446 uint64_t ret_ref = (uint64_t)ret_var.inner;
21447 if (ret_var.is_owned) {
21453 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
21454 LDKHTLCOutputInCommitment obj_conv;
21455 obj_conv.inner = (void*)(obj & (~1));
21456 obj_conv.is_owned = false;
21457 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
21458 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21459 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21460 CVec_u8Z_free(ret_var);
21464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21465 LDKu8slice ser_ref;
21466 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21467 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21468 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
21469 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
21470 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21471 return (uint64_t)ret_conv;
21474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
21475 LDKHTLCOutputInCommitment htlc_conv;
21476 htlc_conv.inner = (void*)(htlc & (~1));
21477 htlc_conv.is_owned = false;
21478 LDKTxCreationKeys keys_conv;
21479 keys_conv.inner = (void*)(keys & (~1));
21480 keys_conv.is_owned = false;
21481 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
21482 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21483 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21484 CVec_u8Z_free(ret_var);
21488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
21489 LDKPublicKey broadcaster_ref;
21490 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
21491 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
21492 LDKPublicKey countersignatory_ref;
21493 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
21494 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
21495 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
21496 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21497 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21498 CVec_u8Z_free(ret_var);
21502 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
21503 unsigned char commitment_txid_arr[32];
21504 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
21505 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
21506 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
21507 LDKHTLCOutputInCommitment htlc_conv;
21508 htlc_conv.inner = (void*)(htlc & (~1));
21509 htlc_conv.is_owned = false;
21510 LDKPublicKey broadcaster_delayed_payment_key_ref;
21511 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21512 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21513 LDKPublicKey revocation_key_ref;
21514 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21515 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21516 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
21517 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21518 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21519 Transaction_free(ret_var);
21523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21524 LDKChannelTransactionParameters this_obj_conv;
21525 this_obj_conv.inner = (void*)(this_obj & (~1));
21526 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21527 ChannelTransactionParameters_free(this_obj_conv);
21530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21531 LDKChannelTransactionParameters this_ptr_conv;
21532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21533 this_ptr_conv.is_owned = false;
21534 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
21535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21537 uint64_t ret_ref = (uint64_t)ret_var.inner;
21538 if (ret_var.is_owned) {
21544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21545 LDKChannelTransactionParameters this_ptr_conv;
21546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21547 this_ptr_conv.is_owned = false;
21548 LDKChannelPublicKeys val_conv;
21549 val_conv.inner = (void*)(val & (~1));
21550 val_conv.is_owned = (val & 1) || (val == 0);
21551 val_conv = ChannelPublicKeys_clone(&val_conv);
21552 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
21555 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21556 LDKChannelTransactionParameters this_ptr_conv;
21557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21558 this_ptr_conv.is_owned = false;
21559 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
21563 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) {
21564 LDKChannelTransactionParameters this_ptr_conv;
21565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21566 this_ptr_conv.is_owned = false;
21567 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
21570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
21571 LDKChannelTransactionParameters this_ptr_conv;
21572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21573 this_ptr_conv.is_owned = false;
21574 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
21578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21579 LDKChannelTransactionParameters this_ptr_conv;
21580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21581 this_ptr_conv.is_owned = false;
21582 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
21585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
21586 LDKChannelTransactionParameters this_ptr_conv;
21587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21588 this_ptr_conv.is_owned = false;
21589 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
21590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21592 uint64_t ret_ref = (uint64_t)ret_var.inner;
21593 if (ret_var.is_owned) {
21599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21600 LDKChannelTransactionParameters this_ptr_conv;
21601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21602 this_ptr_conv.is_owned = false;
21603 LDKCounterpartyChannelTransactionParameters val_conv;
21604 val_conv.inner = (void*)(val & (~1));
21605 val_conv.is_owned = (val & 1) || (val == 0);
21606 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
21607 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
21610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21611 LDKChannelTransactionParameters this_ptr_conv;
21612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21613 this_ptr_conv.is_owned = false;
21614 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
21615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21617 uint64_t ret_ref = (uint64_t)ret_var.inner;
21618 if (ret_var.is_owned) {
21624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21625 LDKChannelTransactionParameters this_ptr_conv;
21626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21627 this_ptr_conv.is_owned = false;
21628 LDKOutPoint val_conv;
21629 val_conv.inner = (void*)(val & (~1));
21630 val_conv.is_owned = (val & 1) || (val == 0);
21631 val_conv = OutPoint_clone(&val_conv);
21632 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
21635 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) {
21636 LDKChannelPublicKeys holder_pubkeys_arg_conv;
21637 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
21638 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
21639 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
21640 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
21641 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
21642 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
21643 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
21644 LDKOutPoint funding_outpoint_arg_conv;
21645 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
21646 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
21647 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
21648 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);
21649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21651 uint64_t ret_ref = (uint64_t)ret_var.inner;
21652 if (ret_var.is_owned) {
21658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21659 LDKChannelTransactionParameters orig_conv;
21660 orig_conv.inner = (void*)(orig & (~1));
21661 orig_conv.is_owned = false;
21662 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
21663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21665 uint64_t ret_ref = (uint64_t)ret_var.inner;
21666 if (ret_var.is_owned) {
21672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21673 LDKCounterpartyChannelTransactionParameters this_obj_conv;
21674 this_obj_conv.inner = (void*)(this_obj & (~1));
21675 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21676 CounterpartyChannelTransactionParameters_free(this_obj_conv);
21679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21680 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21682 this_ptr_conv.is_owned = false;
21683 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
21684 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21685 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21686 uint64_t ret_ref = (uint64_t)ret_var.inner;
21687 if (ret_var.is_owned) {
21693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21694 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21696 this_ptr_conv.is_owned = false;
21697 LDKChannelPublicKeys val_conv;
21698 val_conv.inner = (void*)(val & (~1));
21699 val_conv.is_owned = (val & 1) || (val == 0);
21700 val_conv = ChannelPublicKeys_clone(&val_conv);
21701 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
21704 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21705 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21707 this_ptr_conv.is_owned = false;
21708 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
21712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21713 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21715 this_ptr_conv.is_owned = false;
21716 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
21719 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) {
21720 LDKChannelPublicKeys pubkeys_arg_conv;
21721 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
21722 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
21723 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
21724 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
21725 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21726 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21727 uint64_t ret_ref = (uint64_t)ret_var.inner;
21728 if (ret_var.is_owned) {
21734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21735 LDKCounterpartyChannelTransactionParameters orig_conv;
21736 orig_conv.inner = (void*)(orig & (~1));
21737 orig_conv.is_owned = false;
21738 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
21739 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21740 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21741 uint64_t ret_ref = (uint64_t)ret_var.inner;
21742 if (ret_var.is_owned) {
21748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
21749 LDKChannelTransactionParameters this_arg_conv;
21750 this_arg_conv.inner = (void*)(this_arg & (~1));
21751 this_arg_conv.is_owned = false;
21752 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
21756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
21757 LDKChannelTransactionParameters this_arg_conv;
21758 this_arg_conv.inner = (void*)(this_arg & (~1));
21759 this_arg_conv.is_owned = false;
21760 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
21761 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21762 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21763 uint64_t ret_ref = (uint64_t)ret_var.inner;
21764 if (ret_var.is_owned) {
21770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
21771 LDKChannelTransactionParameters this_arg_conv;
21772 this_arg_conv.inner = (void*)(this_arg & (~1));
21773 this_arg_conv.is_owned = false;
21774 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
21775 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21776 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21777 uint64_t ret_ref = (uint64_t)ret_var.inner;
21778 if (ret_var.is_owned) {
21784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
21785 LDKCounterpartyChannelTransactionParameters obj_conv;
21786 obj_conv.inner = (void*)(obj & (~1));
21787 obj_conv.is_owned = false;
21788 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
21789 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21790 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21791 CVec_u8Z_free(ret_var);
21795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21796 LDKu8slice ser_ref;
21797 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21798 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21799 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
21800 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
21801 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21802 return (uint64_t)ret_conv;
21805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
21806 LDKChannelTransactionParameters obj_conv;
21807 obj_conv.inner = (void*)(obj & (~1));
21808 obj_conv.is_owned = false;
21809 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
21810 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21811 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21812 CVec_u8Z_free(ret_var);
21816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21817 LDKu8slice ser_ref;
21818 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21819 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21820 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
21821 *ret_conv = ChannelTransactionParameters_read(ser_ref);
21822 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21823 return (uint64_t)ret_conv;
21826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21827 LDKDirectedChannelTransactionParameters this_obj_conv;
21828 this_obj_conv.inner = (void*)(this_obj & (~1));
21829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21830 DirectedChannelTransactionParameters_free(this_obj_conv);
21833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
21834 LDKDirectedChannelTransactionParameters this_arg_conv;
21835 this_arg_conv.inner = (void*)(this_arg & (~1));
21836 this_arg_conv.is_owned = false;
21837 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
21838 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21839 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21840 uint64_t ret_ref = (uint64_t)ret_var.inner;
21841 if (ret_var.is_owned) {
21847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
21848 LDKDirectedChannelTransactionParameters this_arg_conv;
21849 this_arg_conv.inner = (void*)(this_arg & (~1));
21850 this_arg_conv.is_owned = false;
21851 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
21852 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21853 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21854 uint64_t ret_ref = (uint64_t)ret_var.inner;
21855 if (ret_var.is_owned) {
21861 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
21862 LDKDirectedChannelTransactionParameters this_arg_conv;
21863 this_arg_conv.inner = (void*)(this_arg & (~1));
21864 this_arg_conv.is_owned = false;
21865 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
21869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
21870 LDKDirectedChannelTransactionParameters this_arg_conv;
21871 this_arg_conv.inner = (void*)(this_arg & (~1));
21872 this_arg_conv.is_owned = false;
21873 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
21877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
21878 LDKDirectedChannelTransactionParameters this_arg_conv;
21879 this_arg_conv.inner = (void*)(this_arg & (~1));
21880 this_arg_conv.is_owned = false;
21881 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
21882 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21883 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21884 uint64_t ret_ref = (uint64_t)ret_var.inner;
21885 if (ret_var.is_owned) {
21891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21892 LDKHolderCommitmentTransaction this_obj_conv;
21893 this_obj_conv.inner = (void*)(this_obj & (~1));
21894 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21895 HolderCommitmentTransaction_free(this_obj_conv);
21898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
21899 LDKHolderCommitmentTransaction this_ptr_conv;
21900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21901 this_ptr_conv.is_owned = false;
21902 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21903 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
21907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21908 LDKHolderCommitmentTransaction this_ptr_conv;
21909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21910 this_ptr_conv.is_owned = false;
21911 LDKSignature val_ref;
21912 CHECK((*env)->GetArrayLength(env, val) == 64);
21913 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21914 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
21917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
21918 LDKHolderCommitmentTransaction this_ptr_conv;
21919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21920 this_ptr_conv.is_owned = false;
21921 LDKCVec_SignatureZ val_constr;
21922 val_constr.datalen = (*env)->GetArrayLength(env, val);
21923 if (val_constr.datalen > 0)
21924 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21926 val_constr.data = NULL;
21927 for (size_t i = 0; i < val_constr.datalen; i++) {
21928 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
21929 LDKSignature val_conv_8_ref;
21930 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
21931 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
21932 val_constr.data[i] = val_conv_8_ref;
21934 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
21937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21938 LDKHolderCommitmentTransaction orig_conv;
21939 orig_conv.inner = (void*)(orig & (~1));
21940 orig_conv.is_owned = false;
21941 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
21942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21944 uint64_t ret_ref = (uint64_t)ret_var.inner;
21945 if (ret_var.is_owned) {
21951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
21952 LDKHolderCommitmentTransaction obj_conv;
21953 obj_conv.inner = (void*)(obj & (~1));
21954 obj_conv.is_owned = false;
21955 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
21956 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21957 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21958 CVec_u8Z_free(ret_var);
21962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21963 LDKu8slice ser_ref;
21964 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21965 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21966 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
21967 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
21968 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21969 return (uint64_t)ret_conv;
21972 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) {
21973 LDKCommitmentTransaction commitment_tx_conv;
21974 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
21975 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
21976 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
21977 LDKSignature counterparty_sig_ref;
21978 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
21979 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
21980 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
21981 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
21982 if (counterparty_htlc_sigs_constr.datalen > 0)
21983 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21985 counterparty_htlc_sigs_constr.data = NULL;
21986 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
21987 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
21988 LDKSignature counterparty_htlc_sigs_conv_8_ref;
21989 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
21990 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
21991 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
21993 LDKPublicKey holder_funding_key_ref;
21994 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
21995 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
21996 LDKPublicKey counterparty_funding_key_ref;
21997 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
21998 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
21999 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22002 uint64_t ret_ref = (uint64_t)ret_var.inner;
22003 if (ret_var.is_owned) {
22009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22010 LDKBuiltCommitmentTransaction this_obj_conv;
22011 this_obj_conv.inner = (void*)(this_obj & (~1));
22012 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22013 BuiltCommitmentTransaction_free(this_obj_conv);
22016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
22017 LDKBuiltCommitmentTransaction this_ptr_conv;
22018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22019 this_ptr_conv.is_owned = false;
22020 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22021 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22022 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22023 Transaction_free(ret_var);
22027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22028 LDKBuiltCommitmentTransaction this_ptr_conv;
22029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22030 this_ptr_conv.is_owned = false;
22031 LDKTransaction val_ref;
22032 val_ref.datalen = (*env)->GetArrayLength(env, val);
22033 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22034 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
22035 val_ref.data_is_owned = true;
22036 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
22040 LDKBuiltCommitmentTransaction this_ptr_conv;
22041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22042 this_ptr_conv.is_owned = false;
22043 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22044 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
22048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22049 LDKBuiltCommitmentTransaction this_ptr_conv;
22050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22051 this_ptr_conv.is_owned = false;
22052 LDKThirtyTwoBytes val_ref;
22053 CHECK((*env)->GetArrayLength(env, val) == 32);
22054 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22055 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
22059 LDKTransaction transaction_arg_ref;
22060 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
22061 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22062 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
22063 transaction_arg_ref.data_is_owned = true;
22064 LDKThirtyTwoBytes txid_arg_ref;
22065 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
22066 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
22067 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22068 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22069 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22070 uint64_t ret_ref = (uint64_t)ret_var.inner;
22071 if (ret_var.is_owned) {
22077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22078 LDKBuiltCommitmentTransaction orig_conv;
22079 orig_conv.inner = (void*)(orig & (~1));
22080 orig_conv.is_owned = false;
22081 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
22082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22084 uint64_t ret_ref = (uint64_t)ret_var.inner;
22085 if (ret_var.is_owned) {
22091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22092 LDKBuiltCommitmentTransaction obj_conv;
22093 obj_conv.inner = (void*)(obj & (~1));
22094 obj_conv.is_owned = false;
22095 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
22096 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22097 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22098 CVec_u8Z_free(ret_var);
22102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22103 LDKu8slice ser_ref;
22104 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22105 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22106 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
22107 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
22108 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22109 return (uint64_t)ret_conv;
22112 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) {
22113 LDKBuiltCommitmentTransaction this_arg_conv;
22114 this_arg_conv.inner = (void*)(this_arg & (~1));
22115 this_arg_conv.is_owned = false;
22116 LDKu8slice funding_redeemscript_ref;
22117 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22118 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22119 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22120 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
22121 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22125 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) {
22126 LDKBuiltCommitmentTransaction this_arg_conv;
22127 this_arg_conv.inner = (void*)(this_arg & (~1));
22128 this_arg_conv.is_owned = false;
22129 unsigned char funding_key_arr[32];
22130 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
22131 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
22132 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22133 LDKu8slice funding_redeemscript_ref;
22134 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22135 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22136 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22137 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
22138 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22143 LDKCommitmentTransaction this_obj_conv;
22144 this_obj_conv.inner = (void*)(this_obj & (~1));
22145 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22146 CommitmentTransaction_free(this_obj_conv);
22149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22150 LDKCommitmentTransaction orig_conv;
22151 orig_conv.inner = (void*)(orig & (~1));
22152 orig_conv.is_owned = false;
22153 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
22154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22156 uint64_t ret_ref = (uint64_t)ret_var.inner;
22157 if (ret_var.is_owned) {
22163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22164 LDKCommitmentTransaction obj_conv;
22165 obj_conv.inner = (void*)(obj & (~1));
22166 obj_conv.is_owned = false;
22167 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
22168 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22169 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22170 CVec_u8Z_free(ret_var);
22174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22175 LDKu8slice ser_ref;
22176 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22177 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22178 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
22179 *ret_conv = CommitmentTransaction_read(ser_ref);
22180 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22181 return (uint64_t)ret_conv;
22184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
22185 LDKCommitmentTransaction this_arg_conv;
22186 this_arg_conv.inner = (void*)(this_arg & (~1));
22187 this_arg_conv.is_owned = false;
22188 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
22192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22193 LDKCommitmentTransaction this_arg_conv;
22194 this_arg_conv.inner = (void*)(this_arg & (~1));
22195 this_arg_conv.is_owned = false;
22196 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
22200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22201 LDKCommitmentTransaction this_arg_conv;
22202 this_arg_conv.inner = (void*)(this_arg & (~1));
22203 this_arg_conv.is_owned = false;
22204 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
22208 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
22209 LDKCommitmentTransaction this_arg_conv;
22210 this_arg_conv.inner = (void*)(this_arg & (~1));
22211 this_arg_conv.is_owned = false;
22212 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
22216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
22217 LDKCommitmentTransaction this_arg_conv;
22218 this_arg_conv.inner = (void*)(this_arg & (~1));
22219 this_arg_conv.is_owned = false;
22220 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
22221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22223 uint64_t ret_ref = (uint64_t)ret_var.inner;
22224 if (ret_var.is_owned) {
22230 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) {
22231 LDKCommitmentTransaction this_arg_conv;
22232 this_arg_conv.inner = (void*)(this_arg & (~1));
22233 this_arg_conv.is_owned = false;
22234 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22235 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22236 channel_parameters_conv.is_owned = false;
22237 LDKChannelPublicKeys broadcaster_keys_conv;
22238 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22239 broadcaster_keys_conv.is_owned = false;
22240 LDKChannelPublicKeys countersignatory_keys_conv;
22241 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22242 countersignatory_keys_conv.is_owned = false;
22243 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
22244 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
22245 return (uint64_t)ret_conv;
22248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22249 LDKTrustedCommitmentTransaction this_obj_conv;
22250 this_obj_conv.inner = (void*)(this_obj & (~1));
22251 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22252 TrustedCommitmentTransaction_free(this_obj_conv);
22255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
22256 LDKTrustedCommitmentTransaction this_arg_conv;
22257 this_arg_conv.inner = (void*)(this_arg & (~1));
22258 this_arg_conv.is_owned = false;
22259 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22260 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
22264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
22265 LDKTrustedCommitmentTransaction this_arg_conv;
22266 this_arg_conv.inner = (void*)(this_arg & (~1));
22267 this_arg_conv.is_owned = false;
22268 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
22269 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22270 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22271 uint64_t ret_ref = (uint64_t)ret_var.inner;
22272 if (ret_var.is_owned) {
22278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
22279 LDKTrustedCommitmentTransaction this_arg_conv;
22280 this_arg_conv.inner = (void*)(this_arg & (~1));
22281 this_arg_conv.is_owned = false;
22282 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
22283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22285 uint64_t ret_ref = (uint64_t)ret_var.inner;
22286 if (ret_var.is_owned) {
22292 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) {
22293 LDKTrustedCommitmentTransaction this_arg_conv;
22294 this_arg_conv.inner = (void*)(this_arg & (~1));
22295 this_arg_conv.is_owned = false;
22296 unsigned char htlc_base_key_arr[32];
22297 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
22298 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
22299 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
22300 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22301 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22302 channel_parameters_conv.is_owned = false;
22303 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
22304 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
22305 return (uint64_t)ret_conv;
22308 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) {
22309 LDKPublicKey broadcaster_payment_basepoint_ref;
22310 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
22311 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
22312 LDKPublicKey countersignatory_payment_basepoint_ref;
22313 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
22314 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
22315 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
22319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22320 LDKInitFeatures a_conv;
22321 a_conv.inner = (void*)(a & (~1));
22322 a_conv.is_owned = false;
22323 LDKInitFeatures b_conv;
22324 b_conv.inner = (void*)(b & (~1));
22325 b_conv.is_owned = false;
22326 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
22330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22331 LDKNodeFeatures a_conv;
22332 a_conv.inner = (void*)(a & (~1));
22333 a_conv.is_owned = false;
22334 LDKNodeFeatures b_conv;
22335 b_conv.inner = (void*)(b & (~1));
22336 b_conv.is_owned = false;
22337 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
22341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22342 LDKChannelFeatures a_conv;
22343 a_conv.inner = (void*)(a & (~1));
22344 a_conv.is_owned = false;
22345 LDKChannelFeatures b_conv;
22346 b_conv.inner = (void*)(b & (~1));
22347 b_conv.is_owned = false;
22348 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
22352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22353 LDKInvoiceFeatures a_conv;
22354 a_conv.inner = (void*)(a & (~1));
22355 a_conv.is_owned = false;
22356 LDKInvoiceFeatures b_conv;
22357 b_conv.inner = (void*)(b & (~1));
22358 b_conv.is_owned = false;
22359 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
22363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22364 LDKInitFeatures orig_conv;
22365 orig_conv.inner = (void*)(orig & (~1));
22366 orig_conv.is_owned = false;
22367 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
22368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22370 uint64_t ret_ref = (uint64_t)ret_var.inner;
22371 if (ret_var.is_owned) {
22377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22378 LDKNodeFeatures orig_conv;
22379 orig_conv.inner = (void*)(orig & (~1));
22380 orig_conv.is_owned = false;
22381 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
22382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22384 uint64_t ret_ref = (uint64_t)ret_var.inner;
22385 if (ret_var.is_owned) {
22391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22392 LDKChannelFeatures orig_conv;
22393 orig_conv.inner = (void*)(orig & (~1));
22394 orig_conv.is_owned = false;
22395 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
22396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22398 uint64_t ret_ref = (uint64_t)ret_var.inner;
22399 if (ret_var.is_owned) {
22405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22406 LDKInvoiceFeatures orig_conv;
22407 orig_conv.inner = (void*)(orig & (~1));
22408 orig_conv.is_owned = false;
22409 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
22410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22412 uint64_t ret_ref = (uint64_t)ret_var.inner;
22413 if (ret_var.is_owned) {
22419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22420 LDKInitFeatures this_obj_conv;
22421 this_obj_conv.inner = (void*)(this_obj & (~1));
22422 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22423 InitFeatures_free(this_obj_conv);
22426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22427 LDKNodeFeatures this_obj_conv;
22428 this_obj_conv.inner = (void*)(this_obj & (~1));
22429 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22430 NodeFeatures_free(this_obj_conv);
22433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22434 LDKChannelFeatures this_obj_conv;
22435 this_obj_conv.inner = (void*)(this_obj & (~1));
22436 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22437 ChannelFeatures_free(this_obj_conv);
22440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22441 LDKInvoiceFeatures this_obj_conv;
22442 this_obj_conv.inner = (void*)(this_obj & (~1));
22443 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22444 InvoiceFeatures_free(this_obj_conv);
22447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
22448 LDKInitFeatures ret_var = InitFeatures_empty();
22449 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22450 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22451 uint64_t ret_ref = (uint64_t)ret_var.inner;
22452 if (ret_var.is_owned) {
22458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
22459 LDKInitFeatures ret_var = InitFeatures_known();
22460 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22461 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22462 uint64_t ret_ref = (uint64_t)ret_var.inner;
22463 if (ret_var.is_owned) {
22469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
22470 LDKNodeFeatures ret_var = NodeFeatures_empty();
22471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22473 uint64_t ret_ref = (uint64_t)ret_var.inner;
22474 if (ret_var.is_owned) {
22480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
22481 LDKNodeFeatures ret_var = NodeFeatures_known();
22482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22484 uint64_t ret_ref = (uint64_t)ret_var.inner;
22485 if (ret_var.is_owned) {
22491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
22492 LDKChannelFeatures ret_var = ChannelFeatures_empty();
22493 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22494 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22495 uint64_t ret_ref = (uint64_t)ret_var.inner;
22496 if (ret_var.is_owned) {
22502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
22503 LDKChannelFeatures ret_var = ChannelFeatures_known();
22504 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22505 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22506 uint64_t ret_ref = (uint64_t)ret_var.inner;
22507 if (ret_var.is_owned) {
22513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
22514 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
22515 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22516 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22517 uint64_t ret_ref = (uint64_t)ret_var.inner;
22518 if (ret_var.is_owned) {
22524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
22525 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
22526 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22527 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22528 uint64_t ret_ref = (uint64_t)ret_var.inner;
22529 if (ret_var.is_owned) {
22535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22536 LDKInitFeatures this_arg_conv;
22537 this_arg_conv.inner = (void*)(this_arg & (~1));
22538 this_arg_conv.is_owned = false;
22539 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
22543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22544 LDKNodeFeatures this_arg_conv;
22545 this_arg_conv.inner = (void*)(this_arg & (~1));
22546 this_arg_conv.is_owned = false;
22547 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
22551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22552 LDKInvoiceFeatures this_arg_conv;
22553 this_arg_conv.inner = (void*)(this_arg & (~1));
22554 this_arg_conv.is_owned = false;
22555 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
22559 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22560 LDKInitFeatures obj_conv;
22561 obj_conv.inner = (void*)(obj & (~1));
22562 obj_conv.is_owned = false;
22563 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
22564 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22565 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22566 CVec_u8Z_free(ret_var);
22570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22571 LDKNodeFeatures obj_conv;
22572 obj_conv.inner = (void*)(obj & (~1));
22573 obj_conv.is_owned = false;
22574 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
22575 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22576 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22577 CVec_u8Z_free(ret_var);
22581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22582 LDKChannelFeatures obj_conv;
22583 obj_conv.inner = (void*)(obj & (~1));
22584 obj_conv.is_owned = false;
22585 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
22586 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22587 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22588 CVec_u8Z_free(ret_var);
22592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22593 LDKInvoiceFeatures obj_conv;
22594 obj_conv.inner = (void*)(obj & (~1));
22595 obj_conv.is_owned = false;
22596 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
22597 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22598 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22599 CVec_u8Z_free(ret_var);
22603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22604 LDKu8slice ser_ref;
22605 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22606 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22607 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22608 *ret_conv = InitFeatures_read(ser_ref);
22609 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22610 return (uint64_t)ret_conv;
22613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22614 LDKu8slice ser_ref;
22615 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22616 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22617 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22618 *ret_conv = NodeFeatures_read(ser_ref);
22619 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22620 return (uint64_t)ret_conv;
22623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22624 LDKu8slice ser_ref;
22625 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22626 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22627 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22628 *ret_conv = ChannelFeatures_read(ser_ref);
22629 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22630 return (uint64_t)ret_conv;
22633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22634 LDKu8slice ser_ref;
22635 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22636 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22637 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
22638 *ret_conv = InvoiceFeatures_read(ser_ref);
22639 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22640 return (uint64_t)ret_conv;
22643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22644 LDKRouteHop this_obj_conv;
22645 this_obj_conv.inner = (void*)(this_obj & (~1));
22646 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22647 RouteHop_free(this_obj_conv);
22650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22651 LDKRouteHop this_ptr_conv;
22652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22653 this_ptr_conv.is_owned = false;
22654 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22655 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
22659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22660 LDKRouteHop this_ptr_conv;
22661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22662 this_ptr_conv.is_owned = false;
22663 LDKPublicKey val_ref;
22664 CHECK((*env)->GetArrayLength(env, val) == 33);
22665 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22666 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
22669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22670 LDKRouteHop this_ptr_conv;
22671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22672 this_ptr_conv.is_owned = false;
22673 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
22674 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22675 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22676 uint64_t ret_ref = (uint64_t)ret_var.inner;
22677 if (ret_var.is_owned) {
22683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22684 LDKRouteHop this_ptr_conv;
22685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22686 this_ptr_conv.is_owned = false;
22687 LDKNodeFeatures val_conv;
22688 val_conv.inner = (void*)(val & (~1));
22689 val_conv.is_owned = (val & 1) || (val == 0);
22690 val_conv = NodeFeatures_clone(&val_conv);
22691 RouteHop_set_node_features(&this_ptr_conv, val_conv);
22694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22695 LDKRouteHop this_ptr_conv;
22696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22697 this_ptr_conv.is_owned = false;
22698 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
22702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22703 LDKRouteHop this_ptr_conv;
22704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22705 this_ptr_conv.is_owned = false;
22706 RouteHop_set_short_channel_id(&this_ptr_conv, val);
22709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22710 LDKRouteHop this_ptr_conv;
22711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22712 this_ptr_conv.is_owned = false;
22713 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
22714 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22715 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22716 uint64_t ret_ref = (uint64_t)ret_var.inner;
22717 if (ret_var.is_owned) {
22723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22724 LDKRouteHop this_ptr_conv;
22725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22726 this_ptr_conv.is_owned = false;
22727 LDKChannelFeatures val_conv;
22728 val_conv.inner = (void*)(val & (~1));
22729 val_conv.is_owned = (val & 1) || (val == 0);
22730 val_conv = ChannelFeatures_clone(&val_conv);
22731 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
22734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22735 LDKRouteHop this_ptr_conv;
22736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22737 this_ptr_conv.is_owned = false;
22738 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
22742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22743 LDKRouteHop this_ptr_conv;
22744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22745 this_ptr_conv.is_owned = false;
22746 RouteHop_set_fee_msat(&this_ptr_conv, val);
22749 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
22750 LDKRouteHop this_ptr_conv;
22751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22752 this_ptr_conv.is_owned = false;
22753 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
22757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22758 LDKRouteHop this_ptr_conv;
22759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22760 this_ptr_conv.is_owned = false;
22761 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
22764 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) {
22765 LDKPublicKey pubkey_arg_ref;
22766 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
22767 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
22768 LDKNodeFeatures node_features_arg_conv;
22769 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
22770 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
22771 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
22772 LDKChannelFeatures channel_features_arg_conv;
22773 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
22774 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
22775 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
22776 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);
22777 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22778 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22779 uint64_t ret_ref = (uint64_t)ret_var.inner;
22780 if (ret_var.is_owned) {
22786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22787 LDKRouteHop orig_conv;
22788 orig_conv.inner = (void*)(orig & (~1));
22789 orig_conv.is_owned = false;
22790 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
22791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22793 uint64_t ret_ref = (uint64_t)ret_var.inner;
22794 if (ret_var.is_owned) {
22800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
22801 LDKRouteHop obj_conv;
22802 obj_conv.inner = (void*)(obj & (~1));
22803 obj_conv.is_owned = false;
22804 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
22805 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22806 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22807 CVec_u8Z_free(ret_var);
22811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22812 LDKu8slice ser_ref;
22813 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22814 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22815 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22816 *ret_conv = RouteHop_read(ser_ref);
22817 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22818 return (uint64_t)ret_conv;
22821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22822 LDKRoute this_obj_conv;
22823 this_obj_conv.inner = (void*)(this_obj & (~1));
22824 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22825 Route_free(this_obj_conv);
22828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
22829 LDKRoute this_ptr_conv;
22830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22831 this_ptr_conv.is_owned = false;
22832 LDKCVec_CVec_RouteHopZZ val_constr;
22833 val_constr.datalen = (*env)->GetArrayLength(env, val);
22834 if (val_constr.datalen > 0)
22835 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
22837 val_constr.data = NULL;
22838 for (size_t m = 0; m < val_constr.datalen; m++) {
22839 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
22840 LDKCVec_RouteHopZ val_conv_12_constr;
22841 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
22842 if (val_conv_12_constr.datalen > 0)
22843 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22845 val_conv_12_constr.data = NULL;
22846 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
22847 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
22848 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
22849 LDKRouteHop val_conv_12_conv_10_conv;
22850 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
22851 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
22852 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
22853 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
22855 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
22856 val_constr.data[m] = val_conv_12_constr;
22858 Route_set_paths(&this_ptr_conv, val_constr);
22861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
22862 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
22863 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
22864 if (paths_arg_constr.datalen > 0)
22865 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
22867 paths_arg_constr.data = NULL;
22868 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
22869 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
22870 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
22871 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
22872 if (paths_arg_conv_12_constr.datalen > 0)
22873 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22875 paths_arg_conv_12_constr.data = NULL;
22876 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
22877 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
22878 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
22879 LDKRouteHop paths_arg_conv_12_conv_10_conv;
22880 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
22881 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
22882 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
22883 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
22885 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
22886 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
22888 LDKRoute ret_var = Route_new(paths_arg_constr);
22889 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22890 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22891 uint64_t ret_ref = (uint64_t)ret_var.inner;
22892 if (ret_var.is_owned) {
22898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22899 LDKRoute orig_conv;
22900 orig_conv.inner = (void*)(orig & (~1));
22901 orig_conv.is_owned = false;
22902 LDKRoute ret_var = Route_clone(&orig_conv);
22903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22905 uint64_t ret_ref = (uint64_t)ret_var.inner;
22906 if (ret_var.is_owned) {
22912 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
22914 obj_conv.inner = (void*)(obj & (~1));
22915 obj_conv.is_owned = false;
22916 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
22917 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22918 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22919 CVec_u8Z_free(ret_var);
22923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22924 LDKu8slice ser_ref;
22925 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22926 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22927 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22928 *ret_conv = Route_read(ser_ref);
22929 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22930 return (uint64_t)ret_conv;
22933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22934 LDKRouteHintHop this_obj_conv;
22935 this_obj_conv.inner = (void*)(this_obj & (~1));
22936 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22937 RouteHintHop_free(this_obj_conv);
22940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22941 LDKRouteHintHop this_ptr_conv;
22942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22943 this_ptr_conv.is_owned = false;
22944 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22945 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
22949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22950 LDKRouteHintHop this_ptr_conv;
22951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22952 this_ptr_conv.is_owned = false;
22953 LDKPublicKey val_ref;
22954 CHECK((*env)->GetArrayLength(env, val) == 33);
22955 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22956 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
22959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22960 LDKRouteHintHop this_ptr_conv;
22961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22962 this_ptr_conv.is_owned = false;
22963 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
22967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22968 LDKRouteHintHop this_ptr_conv;
22969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22970 this_ptr_conv.is_owned = false;
22971 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
22974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
22975 LDKRouteHintHop this_ptr_conv;
22976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22977 this_ptr_conv.is_owned = false;
22978 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
22979 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22980 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22981 uint64_t ret_ref = (uint64_t)ret_var.inner;
22982 if (ret_var.is_owned) {
22988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22989 LDKRouteHintHop this_ptr_conv;
22990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22991 this_ptr_conv.is_owned = false;
22992 LDKRoutingFees val_conv;
22993 val_conv.inner = (void*)(val & (~1));
22994 val_conv.is_owned = (val & 1) || (val == 0);
22995 val_conv = RoutingFees_clone(&val_conv);
22996 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
22999 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23000 LDKRouteHintHop this_ptr_conv;
23001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23002 this_ptr_conv.is_owned = false;
23003 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
23007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23008 LDKRouteHintHop this_ptr_conv;
23009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23010 this_ptr_conv.is_owned = false;
23011 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23015 LDKRouteHintHop this_ptr_conv;
23016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23017 this_ptr_conv.is_owned = false;
23018 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23019 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
23020 uint64_t ret_ref = (uint64_t)ret_copy;
23024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23025 LDKRouteHintHop this_ptr_conv;
23026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23027 this_ptr_conv.is_owned = false;
23028 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23029 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
23032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23033 LDKRouteHintHop this_ptr_conv;
23034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23035 this_ptr_conv.is_owned = false;
23036 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23037 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
23038 uint64_t ret_ref = (uint64_t)ret_copy;
23042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23043 LDKRouteHintHop this_ptr_conv;
23044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23045 this_ptr_conv.is_owned = false;
23046 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23047 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23050 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) {
23051 LDKPublicKey src_node_id_arg_ref;
23052 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
23053 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
23054 LDKRoutingFees fees_arg_conv;
23055 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23056 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23057 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23058 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
23059 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23060 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);
23061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23063 uint64_t ret_ref = (uint64_t)ret_var.inner;
23064 if (ret_var.is_owned) {
23070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23071 LDKRouteHintHop a_conv;
23072 a_conv.inner = (void*)(a & (~1));
23073 a_conv.is_owned = false;
23074 LDKRouteHintHop b_conv;
23075 b_conv.inner = (void*)(b & (~1));
23076 b_conv.is_owned = false;
23077 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
23081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23082 LDKRouteHintHop orig_conv;
23083 orig_conv.inner = (void*)(orig & (~1));
23084 orig_conv.is_owned = false;
23085 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
23086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23088 uint64_t ret_ref = (uint64_t)ret_var.inner;
23089 if (ret_var.is_owned) {
23095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
23096 LDKPublicKey our_node_id_ref;
23097 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
23098 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
23099 LDKNetworkGraph network_conv;
23100 network_conv.inner = (void*)(network & (~1));
23101 network_conv.is_owned = false;
23102 LDKPublicKey payee_ref;
23103 CHECK((*env)->GetArrayLength(env, payee) == 33);
23104 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
23105 LDKInvoiceFeatures payee_features_conv;
23106 payee_features_conv.inner = (void*)(payee_features & (~1));
23107 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
23108 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
23109 LDKCVec_ChannelDetailsZ first_hops_constr;
23110 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
23111 if (first_hops_constr.datalen > 0)
23112 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23114 first_hops_constr.data = NULL;
23115 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
23116 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23117 int64_t first_hops_conv_16 = first_hops_vals[q];
23118 LDKChannelDetails first_hops_conv_16_conv;
23119 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23120 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23121 first_hops_constr.data[q] = first_hops_conv_16_conv;
23123 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
23124 LDKCVec_RouteHintHopZ last_hops_constr;
23125 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
23126 if (last_hops_constr.datalen > 0)
23127 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
23129 last_hops_constr.data = NULL;
23130 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
23131 for (size_t o = 0; o < last_hops_constr.datalen; o++) {
23132 int64_t last_hops_conv_14 = last_hops_vals[o];
23133 LDKRouteHintHop last_hops_conv_14_conv;
23134 last_hops_conv_14_conv.inner = (void*)(last_hops_conv_14 & (~1));
23135 last_hops_conv_14_conv.is_owned = (last_hops_conv_14 & 1) || (last_hops_conv_14 == 0);
23136 last_hops_conv_14_conv = RouteHintHop_clone(&last_hops_conv_14_conv);
23137 last_hops_constr.data[o] = last_hops_conv_14_conv;
23139 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
23140 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23141 if (logger_conv.free == LDKLogger_JCalls_free) {
23142 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23143 LDKLogger_JCalls_clone(logger_conv.this_arg);
23145 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23146 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
23147 FREE(first_hops_constr.data);
23148 return (uint64_t)ret_conv;
23151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23152 LDKNetworkGraph this_obj_conv;
23153 this_obj_conv.inner = (void*)(this_obj & (~1));
23154 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23155 NetworkGraph_free(this_obj_conv);
23158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23159 LDKNetworkGraph orig_conv;
23160 orig_conv.inner = (void*)(orig & (~1));
23161 orig_conv.is_owned = false;
23162 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
23163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23165 uint64_t ret_ref = (uint64_t)ret_var.inner;
23166 if (ret_var.is_owned) {
23172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23173 LDKLockedNetworkGraph this_obj_conv;
23174 this_obj_conv.inner = (void*)(this_obj & (~1));
23175 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23176 LockedNetworkGraph_free(this_obj_conv);
23179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23180 LDKNetGraphMsgHandler this_obj_conv;
23181 this_obj_conv.inner = (void*)(this_obj & (~1));
23182 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23183 NetGraphMsgHandler_free(this_obj_conv);
23186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t chain_access, int64_t logger) {
23187 LDKThirtyTwoBytes genesis_hash_ref;
23188 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
23189 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
23190 LDKAccess *chain_access_conv_ptr = NULL;
23191 if (chain_access != 0) {
23192 LDKAccess chain_access_conv;
23193 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23194 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23195 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23196 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23198 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23199 *chain_access_conv_ptr = chain_access_conv;
23201 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23202 if (logger_conv.free == LDKLogger_JCalls_free) {
23203 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23204 LDKLogger_JCalls_clone(logger_conv.this_arg);
23206 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
23207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23209 uint64_t ret_ref = (uint64_t)ret_var.inner;
23210 if (ret_var.is_owned) {
23216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv *env, jclass clz, int64_t chain_access, int64_t logger, int64_t network_graph) {
23217 LDKAccess *chain_access_conv_ptr = NULL;
23218 if (chain_access != 0) {
23219 LDKAccess chain_access_conv;
23220 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23221 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23222 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23223 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23225 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23226 *chain_access_conv_ptr = chain_access_conv;
23228 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23229 if (logger_conv.free == LDKLogger_JCalls_free) {
23230 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23231 LDKLogger_JCalls_clone(logger_conv.this_arg);
23233 LDKNetworkGraph network_graph_conv;
23234 network_graph_conv.inner = (void*)(network_graph & (~1));
23235 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
23236 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
23237 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
23238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23240 uint64_t ret_ref = (uint64_t)ret_var.inner;
23241 if (ret_var.is_owned) {
23247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
23248 LDKNetGraphMsgHandler this_arg_conv;
23249 this_arg_conv.inner = (void*)(this_arg & (~1));
23250 this_arg_conv.is_owned = false;
23251 LDKAccess *chain_access_conv_ptr = NULL;
23252 if (chain_access != 0) {
23253 LDKAccess chain_access_conv;
23254 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23255 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23256 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23257 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23259 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23260 *chain_access_conv_ptr = chain_access_conv;
23262 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
23265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23266 LDKNetGraphMsgHandler this_arg_conv;
23267 this_arg_conv.inner = (void*)(this_arg & (~1));
23268 this_arg_conv.is_owned = false;
23269 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
23270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23272 uint64_t ret_ref = (uint64_t)ret_var.inner;
23273 if (ret_var.is_owned) {
23279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23280 LDKLockedNetworkGraph this_arg_conv;
23281 this_arg_conv.inner = (void*)(this_arg & (~1));
23282 this_arg_conv.is_owned = false;
23283 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
23284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23286 uint64_t ret_ref = (uint64_t)ret_var.inner;
23287 if (ret_var.is_owned) {
23293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23294 LDKNetGraphMsgHandler this_arg_conv;
23295 this_arg_conv.inner = (void*)(this_arg & (~1));
23296 this_arg_conv.is_owned = false;
23297 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23298 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
23299 return (uint64_t)ret;
23302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23303 LDKNetGraphMsgHandler this_arg_conv;
23304 this_arg_conv.inner = (void*)(this_arg & (~1));
23305 this_arg_conv.is_owned = false;
23306 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23307 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
23308 return (uint64_t)ret;
23311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23312 LDKDirectionalChannelInfo this_obj_conv;
23313 this_obj_conv.inner = (void*)(this_obj & (~1));
23314 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23315 DirectionalChannelInfo_free(this_obj_conv);
23318 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
23319 LDKDirectionalChannelInfo this_ptr_conv;
23320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23321 this_ptr_conv.is_owned = false;
23322 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
23326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23327 LDKDirectionalChannelInfo this_ptr_conv;
23328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23329 this_ptr_conv.is_owned = false;
23330 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
23333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
23334 LDKDirectionalChannelInfo this_ptr_conv;
23335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23336 this_ptr_conv.is_owned = false;
23337 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
23341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23342 LDKDirectionalChannelInfo this_ptr_conv;
23343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23344 this_ptr_conv.is_owned = false;
23345 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
23348 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23349 LDKDirectionalChannelInfo this_ptr_conv;
23350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23351 this_ptr_conv.is_owned = false;
23352 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
23356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23357 LDKDirectionalChannelInfo this_ptr_conv;
23358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23359 this_ptr_conv.is_owned = false;
23360 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
23363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23364 LDKDirectionalChannelInfo this_ptr_conv;
23365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23366 this_ptr_conv.is_owned = false;
23367 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
23371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23372 LDKDirectionalChannelInfo this_ptr_conv;
23373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23374 this_ptr_conv.is_owned = false;
23375 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
23378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23379 LDKDirectionalChannelInfo this_ptr_conv;
23380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23381 this_ptr_conv.is_owned = false;
23382 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23383 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
23384 uint64_t ret_ref = (uint64_t)ret_copy;
23388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23389 LDKDirectionalChannelInfo this_ptr_conv;
23390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23391 this_ptr_conv.is_owned = false;
23392 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23393 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23397 LDKDirectionalChannelInfo this_ptr_conv;
23398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23399 this_ptr_conv.is_owned = false;
23400 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
23401 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23402 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23403 uint64_t ret_ref = (uint64_t)ret_var.inner;
23404 if (ret_var.is_owned) {
23410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23411 LDKDirectionalChannelInfo this_ptr_conv;
23412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23413 this_ptr_conv.is_owned = false;
23414 LDKRoutingFees val_conv;
23415 val_conv.inner = (void*)(val & (~1));
23416 val_conv.is_owned = (val & 1) || (val == 0);
23417 val_conv = RoutingFees_clone(&val_conv);
23418 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
23421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23422 LDKDirectionalChannelInfo this_ptr_conv;
23423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23424 this_ptr_conv.is_owned = false;
23425 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
23426 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23427 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23428 uint64_t ret_ref = (uint64_t)ret_var.inner;
23429 if (ret_var.is_owned) {
23435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23436 LDKDirectionalChannelInfo this_ptr_conv;
23437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23438 this_ptr_conv.is_owned = false;
23439 LDKChannelUpdate val_conv;
23440 val_conv.inner = (void*)(val & (~1));
23441 val_conv.is_owned = (val & 1) || (val == 0);
23442 val_conv = ChannelUpdate_clone(&val_conv);
23443 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
23446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) {
23447 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23448 LDKRoutingFees fees_arg_conv;
23449 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23450 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23451 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23452 LDKChannelUpdate last_update_message_arg_conv;
23453 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
23454 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
23455 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
23456 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv);
23457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23459 uint64_t ret_ref = (uint64_t)ret_var.inner;
23460 if (ret_var.is_owned) {
23466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23467 LDKDirectionalChannelInfo orig_conv;
23468 orig_conv.inner = (void*)(orig & (~1));
23469 orig_conv.is_owned = false;
23470 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
23471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23473 uint64_t ret_ref = (uint64_t)ret_var.inner;
23474 if (ret_var.is_owned) {
23480 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
23481 LDKDirectionalChannelInfo obj_conv;
23482 obj_conv.inner = (void*)(obj & (~1));
23483 obj_conv.is_owned = false;
23484 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
23485 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23486 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23487 CVec_u8Z_free(ret_var);
23491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23492 LDKu8slice ser_ref;
23493 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23494 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23495 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
23496 *ret_conv = DirectionalChannelInfo_read(ser_ref);
23497 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23498 return (uint64_t)ret_conv;
23501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23502 LDKChannelInfo this_obj_conv;
23503 this_obj_conv.inner = (void*)(this_obj & (~1));
23504 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23505 ChannelInfo_free(this_obj_conv);
23508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23509 LDKChannelInfo this_ptr_conv;
23510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23511 this_ptr_conv.is_owned = false;
23512 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
23513 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23514 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23515 uint64_t ret_ref = (uint64_t)ret_var.inner;
23516 if (ret_var.is_owned) {
23522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23523 LDKChannelInfo this_ptr_conv;
23524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23525 this_ptr_conv.is_owned = false;
23526 LDKChannelFeatures val_conv;
23527 val_conv.inner = (void*)(val & (~1));
23528 val_conv.is_owned = (val & 1) || (val == 0);
23529 val_conv = ChannelFeatures_clone(&val_conv);
23530 ChannelInfo_set_features(&this_ptr_conv, val_conv);
23533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23534 LDKChannelInfo this_ptr_conv;
23535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23536 this_ptr_conv.is_owned = false;
23537 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23538 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
23542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23543 LDKChannelInfo this_ptr_conv;
23544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23545 this_ptr_conv.is_owned = false;
23546 LDKPublicKey val_ref;
23547 CHECK((*env)->GetArrayLength(env, val) == 33);
23548 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23549 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
23552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23553 LDKChannelInfo this_ptr_conv;
23554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23555 this_ptr_conv.is_owned = false;
23556 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
23557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23559 uint64_t ret_ref = (uint64_t)ret_var.inner;
23560 if (ret_var.is_owned) {
23566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23567 LDKChannelInfo this_ptr_conv;
23568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23569 this_ptr_conv.is_owned = false;
23570 LDKDirectionalChannelInfo val_conv;
23571 val_conv.inner = (void*)(val & (~1));
23572 val_conv.is_owned = (val & 1) || (val == 0);
23573 val_conv = DirectionalChannelInfo_clone(&val_conv);
23574 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
23577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23578 LDKChannelInfo this_ptr_conv;
23579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23580 this_ptr_conv.is_owned = false;
23581 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23582 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
23586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23587 LDKChannelInfo this_ptr_conv;
23588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23589 this_ptr_conv.is_owned = false;
23590 LDKPublicKey val_ref;
23591 CHECK((*env)->GetArrayLength(env, val) == 33);
23592 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23593 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
23596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23597 LDKChannelInfo this_ptr_conv;
23598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23599 this_ptr_conv.is_owned = false;
23600 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
23601 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23602 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23603 uint64_t ret_ref = (uint64_t)ret_var.inner;
23604 if (ret_var.is_owned) {
23610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23611 LDKChannelInfo this_ptr_conv;
23612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23613 this_ptr_conv.is_owned = false;
23614 LDKDirectionalChannelInfo val_conv;
23615 val_conv.inner = (void*)(val & (~1));
23616 val_conv.is_owned = (val & 1) || (val == 0);
23617 val_conv = DirectionalChannelInfo_clone(&val_conv);
23618 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
23621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
23622 LDKChannelInfo this_ptr_conv;
23623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23624 this_ptr_conv.is_owned = false;
23625 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23626 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
23627 uint64_t ret_ref = (uint64_t)ret_copy;
23631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23632 LDKChannelInfo this_ptr_conv;
23633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23634 this_ptr_conv.is_owned = false;
23635 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23636 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
23639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23640 LDKChannelInfo this_ptr_conv;
23641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23642 this_ptr_conv.is_owned = false;
23643 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
23644 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23645 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23646 uint64_t ret_ref = (uint64_t)ret_var.inner;
23647 if (ret_var.is_owned) {
23653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23654 LDKChannelInfo this_ptr_conv;
23655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23656 this_ptr_conv.is_owned = false;
23657 LDKChannelAnnouncement val_conv;
23658 val_conv.inner = (void*)(val & (~1));
23659 val_conv.is_owned = (val & 1) || (val == 0);
23660 val_conv = ChannelAnnouncement_clone(&val_conv);
23661 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
23664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int8_tArray node_one_arg, int64_t one_to_two_arg, int8_tArray node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) {
23665 LDKChannelFeatures features_arg_conv;
23666 features_arg_conv.inner = (void*)(features_arg & (~1));
23667 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
23668 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
23669 LDKPublicKey node_one_arg_ref;
23670 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
23671 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
23672 LDKDirectionalChannelInfo one_to_two_arg_conv;
23673 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
23674 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
23675 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
23676 LDKPublicKey node_two_arg_ref;
23677 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
23678 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
23679 LDKDirectionalChannelInfo two_to_one_arg_conv;
23680 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
23681 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
23682 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
23683 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
23684 LDKChannelAnnouncement announcement_message_arg_conv;
23685 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
23686 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
23687 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
23688 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
23689 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23690 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23691 uint64_t ret_ref = (uint64_t)ret_var.inner;
23692 if (ret_var.is_owned) {
23698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23699 LDKChannelInfo orig_conv;
23700 orig_conv.inner = (void*)(orig & (~1));
23701 orig_conv.is_owned = false;
23702 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
23703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23705 uint64_t ret_ref = (uint64_t)ret_var.inner;
23706 if (ret_var.is_owned) {
23712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
23713 LDKChannelInfo obj_conv;
23714 obj_conv.inner = (void*)(obj & (~1));
23715 obj_conv.is_owned = false;
23716 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
23717 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23718 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23719 CVec_u8Z_free(ret_var);
23723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23724 LDKu8slice ser_ref;
23725 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23726 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23727 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23728 *ret_conv = ChannelInfo_read(ser_ref);
23729 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23730 return (uint64_t)ret_conv;
23733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23734 LDKRoutingFees this_obj_conv;
23735 this_obj_conv.inner = (void*)(this_obj & (~1));
23736 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23737 RoutingFees_free(this_obj_conv);
23740 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23741 LDKRoutingFees this_ptr_conv;
23742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23743 this_ptr_conv.is_owned = false;
23744 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
23748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23749 LDKRoutingFees this_ptr_conv;
23750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23751 this_ptr_conv.is_owned = false;
23752 RoutingFees_set_base_msat(&this_ptr_conv, val);
23755 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
23756 LDKRoutingFees this_ptr_conv;
23757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23758 this_ptr_conv.is_owned = false;
23759 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
23763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23764 LDKRoutingFees this_ptr_conv;
23765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23766 this_ptr_conv.is_owned = false;
23767 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
23770 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) {
23771 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
23772 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23773 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23774 uint64_t ret_ref = (uint64_t)ret_var.inner;
23775 if (ret_var.is_owned) {
23781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23782 LDKRoutingFees a_conv;
23783 a_conv.inner = (void*)(a & (~1));
23784 a_conv.is_owned = false;
23785 LDKRoutingFees b_conv;
23786 b_conv.inner = (void*)(b & (~1));
23787 b_conv.is_owned = false;
23788 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
23792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23793 LDKRoutingFees orig_conv;
23794 orig_conv.inner = (void*)(orig & (~1));
23795 orig_conv.is_owned = false;
23796 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
23797 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23798 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23799 uint64_t ret_ref = (uint64_t)ret_var.inner;
23800 if (ret_var.is_owned) {
23806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
23807 LDKRoutingFees obj_conv;
23808 obj_conv.inner = (void*)(obj & (~1));
23809 obj_conv.is_owned = false;
23810 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
23811 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23812 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23813 CVec_u8Z_free(ret_var);
23817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23818 LDKu8slice ser_ref;
23819 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23820 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23821 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23822 *ret_conv = RoutingFees_read(ser_ref);
23823 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23824 return (uint64_t)ret_conv;
23827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23828 LDKNodeAnnouncementInfo this_obj_conv;
23829 this_obj_conv.inner = (void*)(this_obj & (~1));
23830 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23831 NodeAnnouncementInfo_free(this_obj_conv);
23834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23835 LDKNodeAnnouncementInfo this_ptr_conv;
23836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23837 this_ptr_conv.is_owned = false;
23838 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
23839 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23840 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23841 uint64_t ret_ref = (uint64_t)ret_var.inner;
23842 if (ret_var.is_owned) {
23848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23849 LDKNodeAnnouncementInfo this_ptr_conv;
23850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23851 this_ptr_conv.is_owned = false;
23852 LDKNodeFeatures val_conv;
23853 val_conv.inner = (void*)(val & (~1));
23854 val_conv.is_owned = (val & 1) || (val == 0);
23855 val_conv = NodeFeatures_clone(&val_conv);
23856 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
23859 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
23860 LDKNodeAnnouncementInfo this_ptr_conv;
23861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23862 this_ptr_conv.is_owned = false;
23863 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
23867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23868 LDKNodeAnnouncementInfo this_ptr_conv;
23869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23870 this_ptr_conv.is_owned = false;
23871 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
23874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
23875 LDKNodeAnnouncementInfo this_ptr_conv;
23876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23877 this_ptr_conv.is_owned = false;
23878 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
23879 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
23883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23884 LDKNodeAnnouncementInfo this_ptr_conv;
23885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23886 this_ptr_conv.is_owned = false;
23887 LDKThreeBytes val_ref;
23888 CHECK((*env)->GetArrayLength(env, val) == 3);
23889 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
23890 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
23893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
23894 LDKNodeAnnouncementInfo this_ptr_conv;
23895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23896 this_ptr_conv.is_owned = false;
23897 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23898 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
23902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23903 LDKNodeAnnouncementInfo this_ptr_conv;
23904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23905 this_ptr_conv.is_owned = false;
23906 LDKThirtyTwoBytes val_ref;
23907 CHECK((*env)->GetArrayLength(env, val) == 32);
23908 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23909 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
23912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23913 LDKNodeAnnouncementInfo this_ptr_conv;
23914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23915 this_ptr_conv.is_owned = false;
23916 LDKCVec_NetAddressZ val_constr;
23917 val_constr.datalen = (*env)->GetArrayLength(env, val);
23918 if (val_constr.datalen > 0)
23919 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23921 val_constr.data = NULL;
23922 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23923 for (size_t m = 0; m < val_constr.datalen; m++) {
23924 int64_t val_conv_12 = val_vals[m];
23925 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
23926 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
23927 val_constr.data[m] = val_conv_12_conv;
23929 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23930 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
23933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23934 LDKNodeAnnouncementInfo this_ptr_conv;
23935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23936 this_ptr_conv.is_owned = false;
23937 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
23938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23940 uint64_t ret_ref = (uint64_t)ret_var.inner;
23941 if (ret_var.is_owned) {
23947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23948 LDKNodeAnnouncementInfo this_ptr_conv;
23949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23950 this_ptr_conv.is_owned = false;
23951 LDKNodeAnnouncement val_conv;
23952 val_conv.inner = (void*)(val & (~1));
23953 val_conv.is_owned = (val & 1) || (val == 0);
23954 val_conv = NodeAnnouncement_clone(&val_conv);
23955 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
23958 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) {
23959 LDKNodeFeatures features_arg_conv;
23960 features_arg_conv.inner = (void*)(features_arg & (~1));
23961 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
23962 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
23963 LDKThreeBytes rgb_arg_ref;
23964 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
23965 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
23966 LDKThirtyTwoBytes alias_arg_ref;
23967 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
23968 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
23969 LDKCVec_NetAddressZ addresses_arg_constr;
23970 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
23971 if (addresses_arg_constr.datalen > 0)
23972 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23974 addresses_arg_constr.data = NULL;
23975 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
23976 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
23977 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
23978 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
23979 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
23981 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
23982 LDKNodeAnnouncement announcement_message_arg_conv;
23983 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
23984 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
23985 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
23986 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
23987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23989 uint64_t ret_ref = (uint64_t)ret_var.inner;
23990 if (ret_var.is_owned) {
23996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23997 LDKNodeAnnouncementInfo orig_conv;
23998 orig_conv.inner = (void*)(orig & (~1));
23999 orig_conv.is_owned = false;
24000 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24003 uint64_t ret_ref = (uint64_t)ret_var.inner;
24004 if (ret_var.is_owned) {
24010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24011 LDKNodeAnnouncementInfo obj_conv;
24012 obj_conv.inner = (void*)(obj & (~1));
24013 obj_conv.is_owned = false;
24014 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24015 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24016 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24017 CVec_u8Z_free(ret_var);
24021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24022 LDKu8slice ser_ref;
24023 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24024 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24025 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24026 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24027 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24028 return (uint64_t)ret_conv;
24031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24032 LDKNodeInfo this_obj_conv;
24033 this_obj_conv.inner = (void*)(this_obj & (~1));
24034 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24035 NodeInfo_free(this_obj_conv);
24038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24039 LDKNodeInfo this_ptr_conv;
24040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24041 this_ptr_conv.is_owned = false;
24042 LDKCVec_u64Z val_constr;
24043 val_constr.datalen = (*env)->GetArrayLength(env, val);
24044 if (val_constr.datalen > 0)
24045 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24047 val_constr.data = NULL;
24048 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24049 for (size_t g = 0; g < val_constr.datalen; g++) {
24050 int64_t val_conv_6 = val_vals[g];
24051 val_constr.data[g] = val_conv_6;
24053 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24054 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
24058 LDKNodeInfo this_ptr_conv;
24059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24060 this_ptr_conv.is_owned = false;
24061 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24062 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24063 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24064 uint64_t ret_ref = (uint64_t)ret_var.inner;
24065 if (ret_var.is_owned) {
24071 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) {
24072 LDKNodeInfo this_ptr_conv;
24073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24074 this_ptr_conv.is_owned = false;
24075 LDKRoutingFees val_conv;
24076 val_conv.inner = (void*)(val & (~1));
24077 val_conv.is_owned = (val & 1) || (val == 0);
24078 val_conv = RoutingFees_clone(&val_conv);
24079 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
24083 LDKNodeInfo this_ptr_conv;
24084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24085 this_ptr_conv.is_owned = false;
24086 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24087 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24088 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24089 uint64_t ret_ref = (uint64_t)ret_var.inner;
24090 if (ret_var.is_owned) {
24096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24097 LDKNodeInfo this_ptr_conv;
24098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24099 this_ptr_conv.is_owned = false;
24100 LDKNodeAnnouncementInfo val_conv;
24101 val_conv.inner = (void*)(val & (~1));
24102 val_conv.is_owned = (val & 1) || (val == 0);
24103 val_conv = NodeAnnouncementInfo_clone(&val_conv);
24104 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
24107 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) {
24108 LDKCVec_u64Z channels_arg_constr;
24109 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
24110 if (channels_arg_constr.datalen > 0)
24111 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24113 channels_arg_constr.data = NULL;
24114 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
24115 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
24116 int64_t channels_arg_conv_6 = channels_arg_vals[g];
24117 channels_arg_constr.data[g] = channels_arg_conv_6;
24119 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
24120 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
24121 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
24122 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
24123 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
24124 LDKNodeAnnouncementInfo announcement_info_arg_conv;
24125 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
24126 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
24127 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
24128 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
24129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24131 uint64_t ret_ref = (uint64_t)ret_var.inner;
24132 if (ret_var.is_owned) {
24138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24139 LDKNodeInfo orig_conv;
24140 orig_conv.inner = (void*)(orig & (~1));
24141 orig_conv.is_owned = false;
24142 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
24143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24145 uint64_t ret_ref = (uint64_t)ret_var.inner;
24146 if (ret_var.is_owned) {
24152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24153 LDKNodeInfo obj_conv;
24154 obj_conv.inner = (void*)(obj & (~1));
24155 obj_conv.is_owned = false;
24156 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
24157 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24158 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24159 CVec_u8Z_free(ret_var);
24163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24164 LDKu8slice ser_ref;
24165 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24166 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24167 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24168 *ret_conv = NodeInfo_read(ser_ref);
24169 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24170 return (uint64_t)ret_conv;
24173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
24174 LDKNetworkGraph obj_conv;
24175 obj_conv.inner = (void*)(obj & (~1));
24176 obj_conv.is_owned = false;
24177 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
24178 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24179 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24180 CVec_u8Z_free(ret_var);
24184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24185 LDKu8slice ser_ref;
24186 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24187 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24188 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24189 *ret_conv = NetworkGraph_read(ser_ref);
24190 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24191 return (uint64_t)ret_conv;
24194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
24195 LDKThirtyTwoBytes genesis_hash_ref;
24196 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
24197 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
24198 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
24199 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24200 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24201 uint64_t ret_ref = (uint64_t)ret_var.inner;
24202 if (ret_var.is_owned) {
24208 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) {
24209 LDKNetworkGraph this_arg_conv;
24210 this_arg_conv.inner = (void*)(this_arg & (~1));
24211 this_arg_conv.is_owned = false;
24212 LDKNodeAnnouncement msg_conv;
24213 msg_conv.inner = (void*)(msg & (~1));
24214 msg_conv.is_owned = false;
24215 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24216 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
24217 return (uint64_t)ret_conv;
24220 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) {
24221 LDKNetworkGraph this_arg_conv;
24222 this_arg_conv.inner = (void*)(this_arg & (~1));
24223 this_arg_conv.is_owned = false;
24224 LDKUnsignedNodeAnnouncement msg_conv;
24225 msg_conv.inner = (void*)(msg & (~1));
24226 msg_conv.is_owned = false;
24227 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24228 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
24229 return (uint64_t)ret_conv;
24232 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) {
24233 LDKNetworkGraph this_arg_conv;
24234 this_arg_conv.inner = (void*)(this_arg & (~1));
24235 this_arg_conv.is_owned = false;
24236 LDKChannelAnnouncement msg_conv;
24237 msg_conv.inner = (void*)(msg & (~1));
24238 msg_conv.is_owned = false;
24239 LDKAccess *chain_access_conv_ptr = NULL;
24240 if (chain_access != 0) {
24241 LDKAccess chain_access_conv;
24242 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24243 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24244 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24245 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24247 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24248 *chain_access_conv_ptr = chain_access_conv;
24250 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24251 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24252 return (uint64_t)ret_conv;
24255 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) {
24256 LDKNetworkGraph this_arg_conv;
24257 this_arg_conv.inner = (void*)(this_arg & (~1));
24258 this_arg_conv.is_owned = false;
24259 LDKUnsignedChannelAnnouncement msg_conv;
24260 msg_conv.inner = (void*)(msg & (~1));
24261 msg_conv.is_owned = false;
24262 LDKAccess *chain_access_conv_ptr = NULL;
24263 if (chain_access != 0) {
24264 LDKAccess chain_access_conv;
24265 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24266 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24267 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24268 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24270 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24271 *chain_access_conv_ptr = chain_access_conv;
24273 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24274 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24275 return (uint64_t)ret_conv;
24278 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) {
24279 LDKNetworkGraph this_arg_conv;
24280 this_arg_conv.inner = (void*)(this_arg & (~1));
24281 this_arg_conv.is_owned = false;
24282 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
24285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24286 LDKNetworkGraph this_arg_conv;
24287 this_arg_conv.inner = (void*)(this_arg & (~1));
24288 this_arg_conv.is_owned = false;
24289 LDKChannelUpdate msg_conv;
24290 msg_conv.inner = (void*)(msg & (~1));
24291 msg_conv.is_owned = false;
24292 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24293 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
24294 return (uint64_t)ret_conv;
24297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24298 LDKNetworkGraph this_arg_conv;
24299 this_arg_conv.inner = (void*)(this_arg & (~1));
24300 this_arg_conv.is_owned = false;
24301 LDKUnsignedChannelUpdate msg_conv;
24302 msg_conv.inner = (void*)(msg & (~1));
24303 msg_conv.is_owned = false;
24304 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24305 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
24306 return (uint64_t)ret_conv;
24309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24310 LDKFilesystemPersister this_obj_conv;
24311 this_obj_conv.inner = (void*)(this_obj & (~1));
24312 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24313 FilesystemPersister_free(this_obj_conv);
24316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
24317 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
24318 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
24319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24321 uint64_t ret_ref = (uint64_t)ret_var.inner;
24322 if (ret_var.is_owned) {
24328 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
24329 LDKFilesystemPersister this_arg_conv;
24330 this_arg_conv.inner = (void*)(this_arg & (~1));
24331 this_arg_conv.is_owned = false;
24332 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
24333 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
24338 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
24339 LDKChannelManager manager_conv;
24340 manager_conv.inner = (void*)(manager & (~1));
24341 manager_conv.is_owned = false;
24342 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24343 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
24344 return (uint64_t)ret_conv;
24347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
24348 LDKFilesystemPersister this_arg_conv;
24349 this_arg_conv.inner = (void*)(this_arg & (~1));
24350 this_arg_conv.is_owned = false;
24351 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
24352 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
24353 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24354 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
24356 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
24357 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
24358 return (uint64_t)ret_conv;
24361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
24362 LDKFilesystemPersister this_arg_conv;
24363 this_arg_conv.inner = (void*)(this_arg & (~1));
24364 this_arg_conv.is_owned = false;
24365 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
24366 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
24367 return (uint64_t)ret;
24370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24371 LDKBackgroundProcessor this_obj_conv;
24372 this_obj_conv.inner = (void*)(this_obj & (~1));
24373 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24374 BackgroundProcessor_free(this_obj_conv);
24377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24378 if ((this_ptr & 1) != 0) return;
24379 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
24380 FREE((void*)this_ptr);
24381 ChannelManagerPersister_free(this_ptr_conv);
24384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t peer_manager, int64_t logger) {
24385 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
24386 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
24387 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24388 LDKChannelManagerPersister_JCalls_clone(persister_conv.this_arg);
24390 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
24391 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
24392 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24393 LDKEventHandler_JCalls_clone(event_handler_conv.this_arg);
24395 LDKChainMonitor chain_monitor_conv;
24396 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
24397 chain_monitor_conv.is_owned = false;
24398 LDKChannelManager channel_manager_conv;
24399 channel_manager_conv.inner = (void*)(channel_manager & (~1));
24400 channel_manager_conv.is_owned = false;
24401 LDKPeerManager peer_manager_conv;
24402 peer_manager_conv.inner = (void*)(peer_manager & (~1));
24403 peer_manager_conv.is_owned = false;
24404 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24405 if (logger_conv.free == LDKLogger_JCalls_free) {
24406 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24407 LDKLogger_JCalls_clone(logger_conv.this_arg);
24409 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
24410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24412 uint64_t ret_ref = (uint64_t)ret_var.inner;
24413 if (ret_var.is_owned) {
24419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
24420 LDKBackgroundProcessor this_arg_conv;
24421 this_arg_conv.inner = (void*)(this_arg & (~1));
24422 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24423 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
24424 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24425 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
24426 return (uint64_t)ret_conv;
24429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
24433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24434 LDKInvoice this_obj_conv;
24435 this_obj_conv.inner = (void*)(this_obj & (~1));
24436 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24437 Invoice_free(this_obj_conv);
24440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24442 a_conv.inner = (void*)(a & (~1));
24443 a_conv.is_owned = false;
24445 b_conv.inner = (void*)(b & (~1));
24446 b_conv.is_owned = false;
24447 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
24451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24452 LDKInvoice orig_conv;
24453 orig_conv.inner = (void*)(orig & (~1));
24454 orig_conv.is_owned = false;
24455 LDKInvoice ret_var = Invoice_clone(&orig_conv);
24456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24458 uint64_t ret_ref = (uint64_t)ret_var.inner;
24459 if (ret_var.is_owned) {
24465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24466 LDKSignedRawInvoice this_obj_conv;
24467 this_obj_conv.inner = (void*)(this_obj & (~1));
24468 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24469 SignedRawInvoice_free(this_obj_conv);
24472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24473 LDKSignedRawInvoice a_conv;
24474 a_conv.inner = (void*)(a & (~1));
24475 a_conv.is_owned = false;
24476 LDKSignedRawInvoice b_conv;
24477 b_conv.inner = (void*)(b & (~1));
24478 b_conv.is_owned = false;
24479 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
24483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24484 LDKSignedRawInvoice orig_conv;
24485 orig_conv.inner = (void*)(orig & (~1));
24486 orig_conv.is_owned = false;
24487 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
24488 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24489 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24490 uint64_t ret_ref = (uint64_t)ret_var.inner;
24491 if (ret_var.is_owned) {
24497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24498 LDKRawInvoice this_obj_conv;
24499 this_obj_conv.inner = (void*)(this_obj & (~1));
24500 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24501 RawInvoice_free(this_obj_conv);
24504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
24505 LDKRawInvoice this_ptr_conv;
24506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24507 this_ptr_conv.is_owned = false;
24508 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
24509 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24510 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24511 uint64_t ret_ref = (uint64_t)ret_var.inner;
24512 if (ret_var.is_owned) {
24518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24519 LDKRawInvoice this_ptr_conv;
24520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24521 this_ptr_conv.is_owned = false;
24522 LDKRawDataPart val_conv;
24523 val_conv.inner = (void*)(val & (~1));
24524 val_conv.is_owned = (val & 1) || (val == 0);
24525 val_conv = RawDataPart_clone(&val_conv);
24526 RawInvoice_set_data(&this_ptr_conv, val_conv);
24529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24530 LDKRawInvoice a_conv;
24531 a_conv.inner = (void*)(a & (~1));
24532 a_conv.is_owned = false;
24533 LDKRawInvoice b_conv;
24534 b_conv.inner = (void*)(b & (~1));
24535 b_conv.is_owned = false;
24536 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
24540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24541 LDKRawInvoice orig_conv;
24542 orig_conv.inner = (void*)(orig & (~1));
24543 orig_conv.is_owned = false;
24544 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
24545 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24546 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24547 uint64_t ret_ref = (uint64_t)ret_var.inner;
24548 if (ret_var.is_owned) {
24554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24555 LDKRawDataPart this_obj_conv;
24556 this_obj_conv.inner = (void*)(this_obj & (~1));
24557 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24558 RawDataPart_free(this_obj_conv);
24561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
24562 LDKRawDataPart this_ptr_conv;
24563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24564 this_ptr_conv.is_owned = false;
24565 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
24566 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24567 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24568 uint64_t ret_ref = (uint64_t)ret_var.inner;
24569 if (ret_var.is_owned) {
24575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24576 LDKRawDataPart this_ptr_conv;
24577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24578 this_ptr_conv.is_owned = false;
24579 LDKPositiveTimestamp val_conv;
24580 val_conv.inner = (void*)(val & (~1));
24581 val_conv.is_owned = (val & 1) || (val == 0);
24582 val_conv = PositiveTimestamp_clone(&val_conv);
24583 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
24586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24587 LDKRawDataPart a_conv;
24588 a_conv.inner = (void*)(a & (~1));
24589 a_conv.is_owned = false;
24590 LDKRawDataPart b_conv;
24591 b_conv.inner = (void*)(b & (~1));
24592 b_conv.is_owned = false;
24593 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
24597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24598 LDKRawDataPart orig_conv;
24599 orig_conv.inner = (void*)(orig & (~1));
24600 orig_conv.is_owned = false;
24601 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
24602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24604 uint64_t ret_ref = (uint64_t)ret_var.inner;
24605 if (ret_var.is_owned) {
24611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24612 LDKPositiveTimestamp this_obj_conv;
24613 this_obj_conv.inner = (void*)(this_obj & (~1));
24614 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24615 PositiveTimestamp_free(this_obj_conv);
24618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24619 LDKPositiveTimestamp a_conv;
24620 a_conv.inner = (void*)(a & (~1));
24621 a_conv.is_owned = false;
24622 LDKPositiveTimestamp b_conv;
24623 b_conv.inner = (void*)(b & (~1));
24624 b_conv.is_owned = false;
24625 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
24629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24630 LDKPositiveTimestamp orig_conv;
24631 orig_conv.inner = (void*)(orig & (~1));
24632 orig_conv.is_owned = false;
24633 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
24634 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24635 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24636 uint64_t ret_ref = (uint64_t)ret_var.inner;
24637 if (ret_var.is_owned) {
24643 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24644 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
24645 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
24649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24650 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
24651 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
24652 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
24656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
24657 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
24658 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
24662 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24663 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
24664 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
24668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24669 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
24670 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
24671 jboolean ret_val = Currency_eq(a_conv, b_conv);
24675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24676 LDKSha256 this_obj_conv;
24677 this_obj_conv.inner = (void*)(this_obj & (~1));
24678 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24679 Sha256_free(this_obj_conv);
24682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24684 a_conv.inner = (void*)(a & (~1));
24685 a_conv.is_owned = false;
24687 b_conv.inner = (void*)(b & (~1));
24688 b_conv.is_owned = false;
24689 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
24693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24694 LDKSha256 orig_conv;
24695 orig_conv.inner = (void*)(orig & (~1));
24696 orig_conv.is_owned = false;
24697 LDKSha256 ret_var = Sha256_clone(&orig_conv);
24698 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24699 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24700 uint64_t ret_ref = (uint64_t)ret_var.inner;
24701 if (ret_var.is_owned) {
24707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24708 LDKDescription this_obj_conv;
24709 this_obj_conv.inner = (void*)(this_obj & (~1));
24710 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24711 Description_free(this_obj_conv);
24714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24715 LDKDescription a_conv;
24716 a_conv.inner = (void*)(a & (~1));
24717 a_conv.is_owned = false;
24718 LDKDescription b_conv;
24719 b_conv.inner = (void*)(b & (~1));
24720 b_conv.is_owned = false;
24721 jboolean ret_val = Description_eq(&a_conv, &b_conv);
24725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24726 LDKDescription orig_conv;
24727 orig_conv.inner = (void*)(orig & (~1));
24728 orig_conv.is_owned = false;
24729 LDKDescription ret_var = Description_clone(&orig_conv);
24730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24732 uint64_t ret_ref = (uint64_t)ret_var.inner;
24733 if (ret_var.is_owned) {
24739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24740 LDKPayeePubKey this_obj_conv;
24741 this_obj_conv.inner = (void*)(this_obj & (~1));
24742 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24743 PayeePubKey_free(this_obj_conv);
24746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24747 LDKPayeePubKey a_conv;
24748 a_conv.inner = (void*)(a & (~1));
24749 a_conv.is_owned = false;
24750 LDKPayeePubKey b_conv;
24751 b_conv.inner = (void*)(b & (~1));
24752 b_conv.is_owned = false;
24753 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
24757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24758 LDKPayeePubKey orig_conv;
24759 orig_conv.inner = (void*)(orig & (~1));
24760 orig_conv.is_owned = false;
24761 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
24762 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24763 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24764 uint64_t ret_ref = (uint64_t)ret_var.inner;
24765 if (ret_var.is_owned) {
24771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24772 LDKExpiryTime this_obj_conv;
24773 this_obj_conv.inner = (void*)(this_obj & (~1));
24774 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24775 ExpiryTime_free(this_obj_conv);
24778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24779 LDKExpiryTime a_conv;
24780 a_conv.inner = (void*)(a & (~1));
24781 a_conv.is_owned = false;
24782 LDKExpiryTime b_conv;
24783 b_conv.inner = (void*)(b & (~1));
24784 b_conv.is_owned = false;
24785 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
24789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24790 LDKExpiryTime orig_conv;
24791 orig_conv.inner = (void*)(orig & (~1));
24792 orig_conv.is_owned = false;
24793 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
24794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24796 uint64_t ret_ref = (uint64_t)ret_var.inner;
24797 if (ret_var.is_owned) {
24803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24804 LDKMinFinalCltvExpiry this_obj_conv;
24805 this_obj_conv.inner = (void*)(this_obj & (~1));
24806 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24807 MinFinalCltvExpiry_free(this_obj_conv);
24810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24811 LDKMinFinalCltvExpiry a_conv;
24812 a_conv.inner = (void*)(a & (~1));
24813 a_conv.is_owned = false;
24814 LDKMinFinalCltvExpiry b_conv;
24815 b_conv.inner = (void*)(b & (~1));
24816 b_conv.is_owned = false;
24817 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
24821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24822 LDKMinFinalCltvExpiry orig_conv;
24823 orig_conv.inner = (void*)(orig & (~1));
24824 orig_conv.is_owned = false;
24825 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
24826 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24827 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24828 uint64_t ret_ref = (uint64_t)ret_var.inner;
24829 if (ret_var.is_owned) {
24835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24836 if ((this_ptr & 1) != 0) return;
24837 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
24838 FREE((void*)this_ptr);
24839 Fallback_free(this_ptr_conv);
24842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24843 LDKFallback* orig_conv = (LDKFallback*)orig;
24844 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
24845 *ret_copy = Fallback_clone(orig_conv);
24846 uint64_t ret_ref = (uint64_t)ret_copy;
24850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24851 LDKFallback* a_conv = (LDKFallback*)a;
24852 LDKFallback* b_conv = (LDKFallback*)b;
24853 jboolean ret_val = Fallback_eq(a_conv, b_conv);
24857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24858 LDKInvoiceSignature this_obj_conv;
24859 this_obj_conv.inner = (void*)(this_obj & (~1));
24860 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24861 InvoiceSignature_free(this_obj_conv);
24864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24865 LDKInvoiceSignature a_conv;
24866 a_conv.inner = (void*)(a & (~1));
24867 a_conv.is_owned = false;
24868 LDKInvoiceSignature b_conv;
24869 b_conv.inner = (void*)(b & (~1));
24870 b_conv.is_owned = false;
24871 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
24875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24876 LDKInvoiceSignature orig_conv;
24877 orig_conv.inner = (void*)(orig & (~1));
24878 orig_conv.is_owned = false;
24879 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
24880 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24881 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24882 uint64_t ret_ref = (uint64_t)ret_var.inner;
24883 if (ret_var.is_owned) {
24889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24890 LDKRouteHint this_obj_conv;
24891 this_obj_conv.inner = (void*)(this_obj & (~1));
24892 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24893 RouteHint_free(this_obj_conv);
24896 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24897 LDKRouteHint a_conv;
24898 a_conv.inner = (void*)(a & (~1));
24899 a_conv.is_owned = false;
24900 LDKRouteHint b_conv;
24901 b_conv.inner = (void*)(b & (~1));
24902 b_conv.is_owned = false;
24903 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
24907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24908 LDKRouteHint orig_conv;
24909 orig_conv.inner = (void*)(orig & (~1));
24910 orig_conv.is_owned = false;
24911 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
24912 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24913 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24914 uint64_t ret_ref = (uint64_t)ret_var.inner;
24915 if (ret_var.is_owned) {
24921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
24922 LDKSignedRawInvoice this_arg_conv;
24923 this_arg_conv.inner = (void*)(this_arg & (~1));
24924 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24925 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
24926 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
24927 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
24928 return (uint64_t)ret_ref;
24931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
24932 LDKSignedRawInvoice this_arg_conv;
24933 this_arg_conv.inner = (void*)(this_arg & (~1));
24934 this_arg_conv.is_owned = false;
24935 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
24936 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24937 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24938 uint64_t ret_ref = (uint64_t)ret_var.inner;
24939 if (ret_var.is_owned) {
24945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
24946 LDKSignedRawInvoice this_arg_conv;
24947 this_arg_conv.inner = (void*)(this_arg & (~1));
24948 this_arg_conv.is_owned = false;
24949 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24950 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
24954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
24955 LDKSignedRawInvoice this_arg_conv;
24956 this_arg_conv.inner = (void*)(this_arg & (~1));
24957 this_arg_conv.is_owned = false;
24958 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
24959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24961 uint64_t ret_ref = (uint64_t)ret_var.inner;
24962 if (ret_var.is_owned) {
24968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
24969 LDKSignedRawInvoice this_arg_conv;
24970 this_arg_conv.inner = (void*)(this_arg & (~1));
24971 this_arg_conv.is_owned = false;
24972 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
24973 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
24974 return (uint64_t)ret_conv;
24977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
24978 LDKSignedRawInvoice this_arg_conv;
24979 this_arg_conv.inner = (void*)(this_arg & (~1));
24980 this_arg_conv.is_owned = false;
24981 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
24985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
24986 LDKRawInvoice this_arg_conv;
24987 this_arg_conv.inner = (void*)(this_arg & (~1));
24988 this_arg_conv.is_owned = false;
24989 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24990 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
24994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
24995 LDKRawInvoice this_arg_conv;
24996 this_arg_conv.inner = (void*)(this_arg & (~1));
24997 this_arg_conv.is_owned = false;
24998 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
24999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25001 uint64_t ret_ref = (uint64_t)ret_var.inner;
25002 if (ret_var.is_owned) {
25008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
25009 LDKRawInvoice this_arg_conv;
25010 this_arg_conv.inner = (void*)(this_arg & (~1));
25011 this_arg_conv.is_owned = false;
25012 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
25013 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25014 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25015 uint64_t ret_ref = (uint64_t)ret_var.inner;
25016 if (ret_var.is_owned) {
25022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25023 LDKRawInvoice this_arg_conv;
25024 this_arg_conv.inner = (void*)(this_arg & (~1));
25025 this_arg_conv.is_owned = false;
25026 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
25027 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25028 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25029 uint64_t ret_ref = (uint64_t)ret_var.inner;
25030 if (ret_var.is_owned) {
25036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25037 LDKRawInvoice this_arg_conv;
25038 this_arg_conv.inner = (void*)(this_arg & (~1));
25039 this_arg_conv.is_owned = false;
25040 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
25041 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25042 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25043 uint64_t ret_ref = (uint64_t)ret_var.inner;
25044 if (ret_var.is_owned) {
25050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25051 LDKRawInvoice this_arg_conv;
25052 this_arg_conv.inner = (void*)(this_arg & (~1));
25053 this_arg_conv.is_owned = false;
25054 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
25055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25057 uint64_t ret_ref = (uint64_t)ret_var.inner;
25058 if (ret_var.is_owned) {
25064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25065 LDKRawInvoice this_arg_conv;
25066 this_arg_conv.inner = (void*)(this_arg & (~1));
25067 this_arg_conv.is_owned = false;
25068 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
25069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25071 uint64_t ret_ref = (uint64_t)ret_var.inner;
25072 if (ret_var.is_owned) {
25078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25079 LDKRawInvoice this_arg_conv;
25080 this_arg_conv.inner = (void*)(this_arg & (~1));
25081 this_arg_conv.is_owned = false;
25082 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25083 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
25087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25088 LDKRawInvoice this_arg_conv;
25089 this_arg_conv.inner = (void*)(this_arg & (~1));
25090 this_arg_conv.is_owned = false;
25091 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
25092 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25093 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25094 uint64_t ret_ref = (uint64_t)ret_var.inner;
25095 if (ret_var.is_owned) {
25101 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25102 LDKRawInvoice this_arg_conv;
25103 this_arg_conv.inner = (void*)(this_arg & (~1));
25104 this_arg_conv.is_owned = false;
25105 LDKCVec_RouteHintZ ret_var = RawInvoice_routes(&this_arg_conv);
25106 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25107 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25108 for (size_t l = 0; l < ret_var.datalen; l++) {
25109 LDKRouteHint ret_conv_11_var = ret_var.data[l];
25110 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25111 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25112 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
25113 if (ret_conv_11_var.is_owned) {
25114 ret_conv_11_ref |= 1;
25116 ret_arr_ptr[l] = ret_conv_11_ref;
25118 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25119 FREE(ret_var.data);
25123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25124 LDKRawInvoice this_arg_conv;
25125 this_arg_conv.inner = (void*)(this_arg & (~1));
25126 this_arg_conv.is_owned = false;
25127 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25128 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
25129 uint64_t ret_ref = (uint64_t)ret_copy;
25133 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25134 LDKRawInvoice this_arg_conv;
25135 this_arg_conv.inner = (void*)(this_arg & (~1));
25136 this_arg_conv.is_owned = false;
25137 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
25141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
25142 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25143 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
25144 return (uint64_t)ret_conv;
25147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
25148 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25149 *ret_conv = PositiveTimestamp_from_system_time(time);
25150 return (uint64_t)ret_conv;
25153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25154 LDKPositiveTimestamp this_arg_conv;
25155 this_arg_conv.inner = (void*)(this_arg & (~1));
25156 this_arg_conv.is_owned = false;
25157 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
25161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25162 LDKPositiveTimestamp this_arg_conv;
25163 this_arg_conv.inner = (void*)(this_arg & (~1));
25164 this_arg_conv.is_owned = false;
25165 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
25169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
25170 LDKInvoice this_arg_conv;
25171 this_arg_conv.inner = (void*)(this_arg & (~1));
25172 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25173 this_arg_conv = Invoice_clone(&this_arg_conv);
25174 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
25175 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25176 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25177 uint64_t ret_ref = (uint64_t)ret_var.inner;
25178 if (ret_var.is_owned) {
25184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25185 LDKInvoice this_arg_conv;
25186 this_arg_conv.inner = (void*)(this_arg & (~1));
25187 this_arg_conv.is_owned = false;
25188 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
25189 *ret_conv = Invoice_check_signature(&this_arg_conv);
25190 return (uint64_t)ret_conv;
25193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
25194 LDKSignedRawInvoice signed_invoice_conv;
25195 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
25196 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
25197 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
25198 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
25199 *ret_conv = Invoice_from_signed(signed_invoice_conv);
25200 return (uint64_t)ret_conv;
25203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25204 LDKInvoice this_arg_conv;
25205 this_arg_conv.inner = (void*)(this_arg & (~1));
25206 this_arg_conv.is_owned = false;
25207 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
25211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25212 LDKInvoice this_arg_conv;
25213 this_arg_conv.inner = (void*)(this_arg & (~1));
25214 this_arg_conv.is_owned = false;
25215 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25216 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
25220 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25221 LDKInvoice this_arg_conv;
25222 this_arg_conv.inner = (void*)(this_arg & (~1));
25223 this_arg_conv.is_owned = false;
25224 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25225 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
25229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25230 LDKInvoice this_arg_conv;
25231 this_arg_conv.inner = (void*)(this_arg & (~1));
25232 this_arg_conv.is_owned = false;
25233 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25234 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
25238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25239 LDKInvoice this_arg_conv;
25240 this_arg_conv.inner = (void*)(this_arg & (~1));
25241 this_arg_conv.is_owned = false;
25242 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
25243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25245 uint64_t ret_ref = (uint64_t)ret_var.inner;
25246 if (ret_var.is_owned) {
25252 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25253 LDKInvoice this_arg_conv;
25254 this_arg_conv.inner = (void*)(this_arg & (~1));
25255 this_arg_conv.is_owned = false;
25256 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25257 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
25261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25262 LDKInvoice this_arg_conv;
25263 this_arg_conv.inner = (void*)(this_arg & (~1));
25264 this_arg_conv.is_owned = false;
25265 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
25269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25270 LDKInvoice this_arg_conv;
25271 this_arg_conv.inner = (void*)(this_arg & (~1));
25272 this_arg_conv.is_owned = false;
25273 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
25277 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25278 LDKInvoice this_arg_conv;
25279 this_arg_conv.inner = (void*)(this_arg & (~1));
25280 this_arg_conv.is_owned = false;
25281 LDKCVec_RouteHintZ ret_var = Invoice_routes(&this_arg_conv);
25282 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25283 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25284 for (size_t l = 0; l < ret_var.datalen; l++) {
25285 LDKRouteHint ret_conv_11_var = ret_var.data[l];
25286 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25287 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25288 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
25289 if (ret_conv_11_var.is_owned) {
25290 ret_conv_11_ref |= 1;
25292 ret_arr_ptr[l] = ret_conv_11_ref;
25294 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25295 FREE(ret_var.data);
25299 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25300 LDKInvoice this_arg_conv;
25301 this_arg_conv.inner = (void*)(this_arg & (~1));
25302 this_arg_conv.is_owned = false;
25303 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
25307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25308 LDKInvoice this_arg_conv;
25309 this_arg_conv.inner = (void*)(this_arg & (~1));
25310 this_arg_conv.is_owned = false;
25311 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25312 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
25313 uint64_t ret_ref = (uint64_t)ret_copy;
25317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
25318 LDKStr description_conv = java_to_owned_str(env, description);
25319 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
25320 *ret_conv = Description_new(description_conv);
25321 return (uint64_t)ret_conv;
25324 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25325 LDKDescription this_arg_conv;
25326 this_arg_conv.inner = (void*)(this_arg & (~1));
25327 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25328 this_arg_conv = Description_clone(&this_arg_conv);
25329 LDKStr ret_str = Description_into_inner(this_arg_conv);
25330 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
25335 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25336 *ret_conv = ExpiryTime_from_seconds(seconds);
25337 return (uint64_t)ret_conv;
25340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
25341 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25342 *ret_conv = ExpiryTime_from_duration(duration);
25343 return (uint64_t)ret_conv;
25346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
25347 LDKExpiryTime this_arg_conv;
25348 this_arg_conv.inner = (void*)(this_arg & (~1));
25349 this_arg_conv.is_owned = false;
25350 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
25354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
25355 LDKExpiryTime this_arg_conv;
25356 this_arg_conv.inner = (void*)(this_arg & (~1));
25357 this_arg_conv.is_owned = false;
25358 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
25362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray hops) {
25363 LDKCVec_RouteHintHopZ hops_constr;
25364 hops_constr.datalen = (*env)->GetArrayLength(env, hops);
25365 if (hops_constr.datalen > 0)
25366 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
25368 hops_constr.data = NULL;
25369 int64_t* hops_vals = (*env)->GetLongArrayElements (env, hops, NULL);
25370 for (size_t o = 0; o < hops_constr.datalen; o++) {
25371 int64_t hops_conv_14 = hops_vals[o];
25372 LDKRouteHintHop hops_conv_14_conv;
25373 hops_conv_14_conv.inner = (void*)(hops_conv_14 & (~1));
25374 hops_conv_14_conv.is_owned = (hops_conv_14 & 1) || (hops_conv_14 == 0);
25375 hops_conv_14_conv = RouteHintHop_clone(&hops_conv_14_conv);
25376 hops_constr.data[o] = hops_conv_14_conv;
25378 (*env)->ReleaseLongArrayElements(env, hops, hops_vals, 0);
25379 LDKCResult_RouteHintCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintCreationErrorZ), "LDKCResult_RouteHintCreationErrorZ");
25380 *ret_conv = RouteHint_new(hops_constr);
25381 return (uint64_t)ret_conv;
25384 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25385 LDKRouteHint this_arg_conv;
25386 this_arg_conv.inner = (void*)(this_arg & (~1));
25387 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25388 this_arg_conv = RouteHint_clone(&this_arg_conv);
25389 LDKCVec_RouteHintHopZ ret_var = RouteHint_into_inner(this_arg_conv);
25390 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25391 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25392 for (size_t o = 0; o < ret_var.datalen; o++) {
25393 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
25394 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25395 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25396 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25397 if (ret_conv_14_var.is_owned) {
25398 ret_conv_14_ref |= 1;
25400 ret_arr_ptr[o] = ret_conv_14_ref;
25402 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25403 FREE(ret_var.data);
25407 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25408 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
25409 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
25413 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25414 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
25415 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
25416 jboolean ret_val = CreationError_eq(a_conv, b_conv);
25420 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25421 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
25422 LDKStr ret_str = CreationError_to_str(o_conv);
25423 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25427 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25428 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
25429 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
25433 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25434 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
25435 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
25436 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
25440 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25441 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
25442 LDKStr ret_str = SemanticError_to_str(o_conv);
25443 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25448 if ((this_ptr & 1) != 0) return;
25449 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
25450 FREE((void*)this_ptr);
25451 SignOrCreationError_free(this_ptr_conv);
25454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25455 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
25456 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
25457 *ret_copy = SignOrCreationError_clone(orig_conv);
25458 uint64_t ret_ref = (uint64_t)ret_copy;
25462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25463 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
25464 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
25465 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
25469 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25470 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
25471 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
25472 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25476 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) {
25477 LDKChannelManager channelmanager_conv;
25478 channelmanager_conv.inner = (void*)(channelmanager & (~1));
25479 channelmanager_conv.is_owned = false;
25480 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25481 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25482 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25483 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
25485 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
25486 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
25487 LDKStr description_conv = java_to_owned_str(env, description);
25488 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
25489 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
25490 return (uint64_t)ret_conv;
25493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25494 LDKStr s_conv = java_to_owned_str(env, s);
25495 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
25496 *ret_conv = SiPrefix_from_str(s_conv);
25497 return (uint64_t)ret_conv;
25500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25501 LDKStr s_conv = java_to_owned_str(env, s);
25502 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
25503 *ret_conv = Invoice_from_str(s_conv);
25504 return (uint64_t)ret_conv;
25507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25508 LDKStr s_conv = java_to_owned_str(env, s);
25509 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
25510 *ret_conv = SignedRawInvoice_from_str(s_conv);
25511 return (uint64_t)ret_conv;
25514 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25516 o_conv.inner = (void*)(o & (~1));
25517 o_conv.is_owned = false;
25518 LDKStr ret_str = Invoice_to_str(&o_conv);
25519 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25523 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25524 LDKSignedRawInvoice o_conv;
25525 o_conv.inner = (void*)(o & (~1));
25526 o_conv.is_owned = false;
25527 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
25528 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25532 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25533 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
25534 LDKStr ret_str = Currency_to_str(o_conv);
25535 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25539 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25540 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
25541 LDKStr ret_str = SiPrefix_to_str(o_conv);
25542 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);