1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
4 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
6 #include "org_ldk_impl_bindings.h"
12 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
13 #define MALLOC(a, _) malloc(a)
14 #define FREE(p) if ((uint64_t)(p) > 1024) { free(p); }
15 #define DO_ASSERT(a) (void)(a)
18 static jmethodID ordinal_meth = NULL;
19 static jmethodID slicedef_meth = NULL;
20 static jclass slicedef_cls = NULL;
21 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
22 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
23 CHECK(ordinal_meth != NULL);
24 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
25 CHECK(slicedef_meth != NULL);
26 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
27 CHECK(slicedef_cls != NULL);
30 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
33 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
36 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
39 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
40 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
41 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
44 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
45 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
46 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
47 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
50 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
51 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
52 vec->datalen = (*env)->GetArrayLength(env, bytes);
53 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
54 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
57 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
58 LDKTransaction *txdata = (LDKTransaction*)ptr;
60 slice.data = txdata->data;
61 slice.datalen = txdata->datalen;
62 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
64 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
65 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
66 txdata->datalen = (*env)->GetArrayLength(env, bytes);
67 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
68 txdata->data_is_owned = false;
69 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
70 return (uint64_t)txdata;
72 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
73 LDKTransaction *tx = (LDKTransaction*)ptr;
74 tx->data_is_owned = true;
75 Transaction_free(*tx);
78 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
79 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
80 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
81 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
82 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
83 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
84 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
85 return (uint64_t)vec->datalen;
87 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
88 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
89 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
90 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
91 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
92 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
93 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
99 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
100 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
101 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
102 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
104 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
105 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
106 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
108 typedef jlongArray int64_tArray;
109 typedef jbyteArray int8_tArray;
111 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
112 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
113 char* conv_buf = MALLOC(len + 1, "str conv buf");
114 memcpy(conv_buf, chars, len);
116 jstring ret = (*env)->NewStringUTF(env, conv_buf);
120 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
121 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
122 char* newchars = MALLOC(str_len + 1, "String chars");
123 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
124 memcpy(newchars, jchars, str_len);
125 newchars[str_len] = 0;
126 (*env)->ReleaseStringUTFChars(env, str, jchars);
130 .chars_is_owned = true
135 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
136 return str_ref_to_java(env, "v0.0.98.4", strlen("v0.0.98.4"));
138 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
139 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
141 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
142 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
144 static jclass arr_of_B_clz = NULL;
145 static jclass arr_of_J_clz = NULL;
146 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
147 arr_of_B_clz = (*env)->FindClass(env, "[B");
148 CHECK(arr_of_B_clz != NULL);
149 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
150 arr_of_J_clz = (*env)->FindClass(env, "[J");
151 CHECK(arr_of_J_clz != NULL);
152 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
154 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
155 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
156 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
157 case 0: return LDKAccessError_UnknownChain;
158 case 1: return LDKAccessError_UnknownTx;
162 static jclass AccessError_class = NULL;
163 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
164 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
165 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
166 AccessError_class = (*env)->NewGlobalRef(env, clz);
167 CHECK(AccessError_class != NULL);
168 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
169 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
170 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
171 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
173 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
175 case LDKAccessError_UnknownChain:
176 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
177 case LDKAccessError_UnknownTx:
178 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
183 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
184 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
185 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
186 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
190 static jclass ChannelMonitorUpdateErr_class = NULL;
191 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
192 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
193 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
194 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
195 CHECK(ChannelMonitorUpdateErr_class != NULL);
196 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
197 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
198 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
199 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
201 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
203 case LDKChannelMonitorUpdateErr_TemporaryFailure:
204 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
205 case LDKChannelMonitorUpdateErr_PermanentFailure:
206 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
211 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
212 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
213 case 0: return LDKConfirmationTarget_Background;
214 case 1: return LDKConfirmationTarget_Normal;
215 case 2: return LDKConfirmationTarget_HighPriority;
219 static jclass ConfirmationTarget_class = NULL;
220 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
221 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
222 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
223 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
224 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
225 CHECK(ConfirmationTarget_class != NULL);
226 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
227 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
228 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
229 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
230 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
231 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
233 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
235 case LDKConfirmationTarget_Background:
236 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
237 case LDKConfirmationTarget_Normal:
238 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
239 case LDKConfirmationTarget_HighPriority:
240 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
245 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
246 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
247 case 0: return LDKCreationError_DescriptionTooLong;
248 case 1: return LDKCreationError_RouteTooLong;
249 case 2: return LDKCreationError_TimestampOutOfBounds;
250 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
254 static jclass CreationError_class = NULL;
255 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
256 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
257 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
258 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
259 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
260 CreationError_class = (*env)->NewGlobalRef(env, clz);
261 CHECK(CreationError_class != NULL);
262 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
263 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
264 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
265 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
266 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
267 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
268 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
269 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
271 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
273 case LDKCreationError_DescriptionTooLong:
274 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
275 case LDKCreationError_RouteTooLong:
276 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
277 case LDKCreationError_TimestampOutOfBounds:
278 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
279 case LDKCreationError_ExpiryTimeOutOfBounds:
280 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
285 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
286 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
287 case 0: return LDKCurrency_Bitcoin;
288 case 1: return LDKCurrency_BitcoinTestnet;
289 case 2: return LDKCurrency_Regtest;
290 case 3: return LDKCurrency_Simnet;
291 case 4: return LDKCurrency_Signet;
295 static jclass Currency_class = NULL;
296 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
297 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
298 static jfieldID Currency_LDKCurrency_Regtest = NULL;
299 static jfieldID Currency_LDKCurrency_Simnet = NULL;
300 static jfieldID Currency_LDKCurrency_Signet = NULL;
301 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
302 Currency_class = (*env)->NewGlobalRef(env, clz);
303 CHECK(Currency_class != NULL);
304 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
305 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
306 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
307 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
308 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
309 CHECK(Currency_LDKCurrency_Regtest != NULL);
310 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
311 CHECK(Currency_LDKCurrency_Simnet != NULL);
312 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
313 CHECK(Currency_LDKCurrency_Signet != NULL);
315 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
317 case LDKCurrency_Bitcoin:
318 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
319 case LDKCurrency_BitcoinTestnet:
320 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
321 case LDKCurrency_Regtest:
322 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
323 case LDKCurrency_Simnet:
324 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
325 case LDKCurrency_Signet:
326 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
331 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
332 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
333 case 0: return LDKIOError_NotFound;
334 case 1: return LDKIOError_PermissionDenied;
335 case 2: return LDKIOError_ConnectionRefused;
336 case 3: return LDKIOError_ConnectionReset;
337 case 4: return LDKIOError_ConnectionAborted;
338 case 5: return LDKIOError_NotConnected;
339 case 6: return LDKIOError_AddrInUse;
340 case 7: return LDKIOError_AddrNotAvailable;
341 case 8: return LDKIOError_BrokenPipe;
342 case 9: return LDKIOError_AlreadyExists;
343 case 10: return LDKIOError_WouldBlock;
344 case 11: return LDKIOError_InvalidInput;
345 case 12: return LDKIOError_InvalidData;
346 case 13: return LDKIOError_TimedOut;
347 case 14: return LDKIOError_WriteZero;
348 case 15: return LDKIOError_Interrupted;
349 case 16: return LDKIOError_Other;
350 case 17: return LDKIOError_UnexpectedEof;
354 static jclass IOError_class = NULL;
355 static jfieldID IOError_LDKIOError_NotFound = NULL;
356 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
357 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
358 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
359 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
360 static jfieldID IOError_LDKIOError_NotConnected = NULL;
361 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
362 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
363 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
364 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
365 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
366 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
367 static jfieldID IOError_LDKIOError_InvalidData = NULL;
368 static jfieldID IOError_LDKIOError_TimedOut = NULL;
369 static jfieldID IOError_LDKIOError_WriteZero = NULL;
370 static jfieldID IOError_LDKIOError_Interrupted = NULL;
371 static jfieldID IOError_LDKIOError_Other = NULL;
372 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
373 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
374 IOError_class = (*env)->NewGlobalRef(env, clz);
375 CHECK(IOError_class != NULL);
376 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
377 CHECK(IOError_LDKIOError_NotFound != NULL);
378 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
379 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
380 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
381 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
382 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
383 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
384 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
385 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
386 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
387 CHECK(IOError_LDKIOError_NotConnected != NULL);
388 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
389 CHECK(IOError_LDKIOError_AddrInUse != NULL);
390 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
391 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
392 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
393 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
394 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
395 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
396 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
397 CHECK(IOError_LDKIOError_WouldBlock != NULL);
398 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
399 CHECK(IOError_LDKIOError_InvalidInput != NULL);
400 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
401 CHECK(IOError_LDKIOError_InvalidData != NULL);
402 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
403 CHECK(IOError_LDKIOError_TimedOut != NULL);
404 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
405 CHECK(IOError_LDKIOError_WriteZero != NULL);
406 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
407 CHECK(IOError_LDKIOError_Interrupted != NULL);
408 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
409 CHECK(IOError_LDKIOError_Other != NULL);
410 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
411 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
413 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
415 case LDKIOError_NotFound:
416 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
417 case LDKIOError_PermissionDenied:
418 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
419 case LDKIOError_ConnectionRefused:
420 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
421 case LDKIOError_ConnectionReset:
422 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
423 case LDKIOError_ConnectionAborted:
424 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
425 case LDKIOError_NotConnected:
426 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
427 case LDKIOError_AddrInUse:
428 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
429 case LDKIOError_AddrNotAvailable:
430 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
431 case LDKIOError_BrokenPipe:
432 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
433 case LDKIOError_AlreadyExists:
434 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
435 case LDKIOError_WouldBlock:
436 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
437 case LDKIOError_InvalidInput:
438 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
439 case LDKIOError_InvalidData:
440 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
441 case LDKIOError_TimedOut:
442 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
443 case LDKIOError_WriteZero:
444 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
445 case LDKIOError_Interrupted:
446 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
447 case LDKIOError_Other:
448 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
449 case LDKIOError_UnexpectedEof:
450 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
455 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
456 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
457 case 0: return LDKLevel_Off;
458 case 1: return LDKLevel_Error;
459 case 2: return LDKLevel_Warn;
460 case 3: return LDKLevel_Info;
461 case 4: return LDKLevel_Debug;
462 case 5: return LDKLevel_Trace;
466 static jclass Level_class = NULL;
467 static jfieldID Level_LDKLevel_Off = NULL;
468 static jfieldID Level_LDKLevel_Error = NULL;
469 static jfieldID Level_LDKLevel_Warn = NULL;
470 static jfieldID Level_LDKLevel_Info = NULL;
471 static jfieldID Level_LDKLevel_Debug = NULL;
472 static jfieldID Level_LDKLevel_Trace = NULL;
473 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
474 Level_class = (*env)->NewGlobalRef(env, clz);
475 CHECK(Level_class != NULL);
476 Level_LDKLevel_Off = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Off", "Lorg/ldk/enums/Level;");
477 CHECK(Level_LDKLevel_Off != NULL);
478 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
479 CHECK(Level_LDKLevel_Error != NULL);
480 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
481 CHECK(Level_LDKLevel_Warn != NULL);
482 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
483 CHECK(Level_LDKLevel_Info != NULL);
484 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
485 CHECK(Level_LDKLevel_Debug != NULL);
486 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
487 CHECK(Level_LDKLevel_Trace != NULL);
489 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
492 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Off);
494 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
496 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
498 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
500 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
502 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
507 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
508 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
509 case 0: return LDKNetwork_Bitcoin;
510 case 1: return LDKNetwork_Testnet;
511 case 2: return LDKNetwork_Regtest;
512 case 3: return LDKNetwork_Signet;
516 static jclass Network_class = NULL;
517 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
518 static jfieldID Network_LDKNetwork_Testnet = NULL;
519 static jfieldID Network_LDKNetwork_Regtest = NULL;
520 static jfieldID Network_LDKNetwork_Signet = NULL;
521 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
522 Network_class = (*env)->NewGlobalRef(env, clz);
523 CHECK(Network_class != NULL);
524 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
525 CHECK(Network_LDKNetwork_Bitcoin != NULL);
526 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
527 CHECK(Network_LDKNetwork_Testnet != NULL);
528 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
529 CHECK(Network_LDKNetwork_Regtest != NULL);
530 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
531 CHECK(Network_LDKNetwork_Signet != NULL);
533 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
535 case LDKNetwork_Bitcoin:
536 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
537 case LDKNetwork_Testnet:
538 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
539 case LDKNetwork_Regtest:
540 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
541 case LDKNetwork_Signet:
542 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
547 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
548 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
549 case 0: return LDKSecp256k1Error_IncorrectSignature;
550 case 1: return LDKSecp256k1Error_InvalidMessage;
551 case 2: return LDKSecp256k1Error_InvalidPublicKey;
552 case 3: return LDKSecp256k1Error_InvalidSignature;
553 case 4: return LDKSecp256k1Error_InvalidSecretKey;
554 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
555 case 6: return LDKSecp256k1Error_InvalidTweak;
556 case 7: return LDKSecp256k1Error_TweakCheckFailed;
557 case 8: return LDKSecp256k1Error_NotEnoughMemory;
561 static jclass Secp256k1Error_class = NULL;
562 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
563 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
564 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
565 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
566 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
567 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
568 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
569 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
570 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
571 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
572 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
573 CHECK(Secp256k1Error_class != NULL);
574 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
575 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
576 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
577 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
578 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
579 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
580 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
581 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
582 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
583 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
584 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
585 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
586 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
587 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
588 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
589 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
590 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
591 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
593 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
595 case LDKSecp256k1Error_IncorrectSignature:
596 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
597 case LDKSecp256k1Error_InvalidMessage:
598 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
599 case LDKSecp256k1Error_InvalidPublicKey:
600 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
601 case LDKSecp256k1Error_InvalidSignature:
602 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
603 case LDKSecp256k1Error_InvalidSecretKey:
604 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
605 case LDKSecp256k1Error_InvalidRecoveryId:
606 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
607 case LDKSecp256k1Error_InvalidTweak:
608 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
609 case LDKSecp256k1Error_TweakCheckFailed:
610 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
611 case LDKSecp256k1Error_NotEnoughMemory:
612 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
617 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
618 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
619 case 0: return LDKSemanticError_NoPaymentHash;
620 case 1: return LDKSemanticError_MultiplePaymentHashes;
621 case 2: return LDKSemanticError_NoDescription;
622 case 3: return LDKSemanticError_MultipleDescriptions;
623 case 4: return LDKSemanticError_MultiplePaymentSecrets;
624 case 5: return LDKSemanticError_InvalidFeatures;
625 case 6: return LDKSemanticError_InvalidRecoveryId;
626 case 7: return LDKSemanticError_InvalidSignature;
630 static jclass SemanticError_class = NULL;
631 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
632 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
633 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
634 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
635 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
636 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
637 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
638 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
639 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
640 SemanticError_class = (*env)->NewGlobalRef(env, clz);
641 CHECK(SemanticError_class != NULL);
642 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
643 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
644 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
645 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
646 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
647 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
648 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
649 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
650 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
651 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
652 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
653 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
654 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
655 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
656 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
657 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
659 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
661 case LDKSemanticError_NoPaymentHash:
662 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
663 case LDKSemanticError_MultiplePaymentHashes:
664 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
665 case LDKSemanticError_NoDescription:
666 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
667 case LDKSemanticError_MultipleDescriptions:
668 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
669 case LDKSemanticError_MultiplePaymentSecrets:
670 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
671 case LDKSemanticError_InvalidFeatures:
672 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
673 case LDKSemanticError_InvalidRecoveryId:
674 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
675 case LDKSemanticError_InvalidSignature:
676 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
681 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
682 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
683 case 0: return LDKSiPrefix_Milli;
684 case 1: return LDKSiPrefix_Micro;
685 case 2: return LDKSiPrefix_Nano;
686 case 3: return LDKSiPrefix_Pico;
690 static jclass SiPrefix_class = NULL;
691 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
692 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
693 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
694 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
695 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
696 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
697 CHECK(SiPrefix_class != NULL);
698 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
699 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
700 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
701 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
702 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
703 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
704 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
705 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
707 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
709 case LDKSiPrefix_Milli:
710 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
711 case LDKSiPrefix_Micro:
712 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
713 case LDKSiPrefix_Nano:
714 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
715 case LDKSiPrefix_Pico:
716 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
722 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
723 ret->datalen = (*env)->GetArrayLength(env, elems);
724 if (ret->datalen == 0) {
727 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
728 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
729 for (size_t i = 0; i < ret->datalen; i++) {
730 ret->data[i] = java_elems[i];
732 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
734 return (uint64_t)ret;
736 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
737 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
738 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
742 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
745 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
746 CHECK(val->result_ok);
747 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
748 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
751 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
752 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
753 CHECK(!val->result_ok);
754 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
758 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
761 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
762 CHECK(val->result_ok);
763 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
764 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
767 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
768 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
769 CHECK(!val->result_ok);
770 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
774 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
777 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
778 CHECK(val->result_ok);
779 LDKTxCreationKeys res_var = (*val->contents.result);
780 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
781 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
782 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
786 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
787 CHECK(!val->result_ok);
788 LDKDecodeError err_var = (*val->contents.err);
789 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
790 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
791 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
795 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
798 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
799 CHECK(val->result_ok);
800 LDKChannelPublicKeys res_var = (*val->contents.result);
801 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
802 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
803 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
807 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
808 CHECK(!val->result_ok);
809 LDKDecodeError err_var = (*val->contents.err);
810 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
811 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
812 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
816 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
819 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
820 CHECK(val->result_ok);
821 LDKTxCreationKeys res_var = (*val->contents.result);
822 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
823 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
824 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
827 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
828 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
829 CHECK(!val->result_ok);
830 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
833 static jclass LDKCOption_u32Z_Some_class = NULL;
834 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
835 static jclass LDKCOption_u32Z_None_class = NULL;
836 static jmethodID LDKCOption_u32Z_None_meth = NULL;
837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
838 LDKCOption_u32Z_Some_class =
839 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
840 CHECK(LDKCOption_u32Z_Some_class != NULL);
841 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
842 CHECK(LDKCOption_u32Z_Some_meth != NULL);
843 LDKCOption_u32Z_None_class =
844 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
845 CHECK(LDKCOption_u32Z_None_class != NULL);
846 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
847 CHECK(LDKCOption_u32Z_None_meth != NULL);
849 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
850 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
852 case LDKCOption_u32Z_Some: {
853 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
855 case LDKCOption_u32Z_None: {
856 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
862 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
865 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
866 CHECK(val->result_ok);
867 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
868 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
869 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
870 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
874 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
875 CHECK(!val->result_ok);
876 LDKDecodeError err_var = (*val->contents.err);
877 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
878 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
879 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
883 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
886 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
887 CHECK(val->result_ok);
888 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
889 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
890 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
891 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
895 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
896 CHECK(!val->result_ok);
897 LDKDecodeError err_var = (*val->contents.err);
898 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
899 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
900 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
904 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
907 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
908 CHECK(val->result_ok);
909 LDKChannelTransactionParameters res_var = (*val->contents.result);
910 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
911 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
912 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
916 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
917 CHECK(!val->result_ok);
918 LDKDecodeError err_var = (*val->contents.err);
919 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
920 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
921 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
925 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
928 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
929 CHECK(val->result_ok);
930 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
931 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
932 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
933 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
937 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
938 CHECK(!val->result_ok);
939 LDKDecodeError err_var = (*val->contents.err);
940 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
941 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
942 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
946 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
949 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
950 CHECK(val->result_ok);
951 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
952 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
953 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
954 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
958 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
959 CHECK(!val->result_ok);
960 LDKDecodeError err_var = (*val->contents.err);
961 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
962 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
963 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
967 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
970 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
971 CHECK(val->result_ok);
972 LDKCommitmentTransaction res_var = (*val->contents.result);
973 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
974 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
975 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
979 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
980 CHECK(!val->result_ok);
981 LDKDecodeError err_var = (*val->contents.err);
982 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
983 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
984 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
988 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
991 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
992 CHECK(val->result_ok);
993 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
994 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
995 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
996 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1000 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1001 CHECK(!val->result_ok);
1002 return *val->contents.err;
1004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1005 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1007 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1008 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1009 CHECK(val->result_ok);
1010 LDKCVec_SignatureZ res_var = (*val->contents.result);
1011 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1013 for (size_t i = 0; i < res_var.datalen; i++) {
1014 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1015 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1016 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1021 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1022 CHECK(!val->result_ok);
1023 return *val->contents.err;
1025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1026 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1029 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1030 CHECK(val->result_ok);
1031 return *val->contents.result;
1033 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1034 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1035 CHECK(!val->result_ok);
1036 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1040 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1043 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1044 CHECK(val->result_ok);
1045 LDKRouteHop res_var = (*val->contents.result);
1046 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1047 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1048 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1052 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1053 CHECK(!val->result_ok);
1054 LDKDecodeError err_var = (*val->contents.err);
1055 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1056 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1057 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1061 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1062 ret->datalen = (*env)->GetArrayLength(env, elems);
1063 if (ret->datalen == 0) {
1066 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1067 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1068 for (size_t i = 0; i < ret->datalen; i++) {
1069 int64_t arr_elem = java_elems[i];
1070 LDKRouteHop arr_elem_conv;
1071 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1072 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1073 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1074 ret->data[i] = arr_elem_conv;
1076 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1078 return (uint64_t)ret;
1080 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1081 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1082 for (size_t i = 0; i < ret.datalen; i++) {
1083 ret.data[i] = RouteHop_clone(&orig->data[i]);
1087 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1088 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1089 for (size_t i = 0; i < ret.datalen; i++) {
1090 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1095 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1098 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1099 CHECK(val->result_ok);
1100 LDKRoute res_var = (*val->contents.result);
1101 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1102 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1103 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1107 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1108 CHECK(!val->result_ok);
1109 LDKDecodeError err_var = (*val->contents.err);
1110 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1111 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1112 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1115 static jclass LDKCOption_u64Z_Some_class = NULL;
1116 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1117 static jclass LDKCOption_u64Z_None_class = NULL;
1118 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1120 LDKCOption_u64Z_Some_class =
1121 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1122 CHECK(LDKCOption_u64Z_Some_class != NULL);
1123 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1124 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1125 LDKCOption_u64Z_None_class =
1126 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1127 CHECK(LDKCOption_u64Z_None_class != NULL);
1128 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1129 CHECK(LDKCOption_u64Z_None_meth != NULL);
1131 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1132 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1134 case LDKCOption_u64Z_Some: {
1135 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1137 case LDKCOption_u64Z_None: {
1138 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1144 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1145 ret->datalen = (*env)->GetArrayLength(env, elems);
1146 if (ret->datalen == 0) {
1149 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1150 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1151 for (size_t i = 0; i < ret->datalen; i++) {
1152 int64_t arr_elem = java_elems[i];
1153 LDKChannelDetails arr_elem_conv;
1154 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1155 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1156 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1157 ret->data[i] = arr_elem_conv;
1159 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1161 return (uint64_t)ret;
1163 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1164 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1165 for (size_t i = 0; i < ret.datalen; i++) {
1166 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1171 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1172 ret->datalen = (*env)->GetArrayLength(env, elems);
1173 if (ret->datalen == 0) {
1176 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1177 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1178 for (size_t i = 0; i < ret->datalen; i++) {
1179 int64_t arr_elem = java_elems[i];
1180 LDKRouteHint arr_elem_conv;
1181 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1182 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1183 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1184 ret->data[i] = arr_elem_conv;
1186 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1188 return (uint64_t)ret;
1190 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1191 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1192 for (size_t i = 0; i < ret.datalen; i++) {
1193 ret.data[i] = RouteHint_clone(&orig->data[i]);
1197 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1198 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1201 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1202 CHECK(val->result_ok);
1203 LDKRoute res_var = (*val->contents.result);
1204 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1205 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1206 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1210 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1211 CHECK(!val->result_ok);
1212 LDKLightningError err_var = (*val->contents.err);
1213 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1214 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1215 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1219 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1222 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1223 CHECK(val->result_ok);
1224 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1225 return (uint64_t)res_ref;
1227 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1228 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1229 CHECK(!val->result_ok);
1230 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1234 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1236 LDKTransaction b_ref;
1237 b_ref.datalen = (*env)->GetArrayLength(env, b);
1238 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1239 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1240 b_ref.data_is_owned = false;
1242 return (uint64_t)ret;
1244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1245 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1249 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1250 LDKTransaction b_var = tuple->b;
1251 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1252 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1256 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1257 ret->datalen = (*env)->GetArrayLength(env, elems);
1258 if (ret->datalen == 0) {
1261 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1262 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1263 for (size_t i = 0; i < ret->datalen; i++) {
1264 int64_t arr_elem = java_elems[i];
1265 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1266 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1267 ret->data[i] = arr_elem_conv;
1269 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1271 return (uint64_t)ret;
1273 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1274 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1275 for (size_t i = 0; i < ret.datalen; i++) {
1276 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1280 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1281 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1282 for (size_t i = 0; i < ret.datalen; i++) {
1283 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1288 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1291 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1292 CHECK(val->result_ok);
1293 return *val->contents.result;
1295 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1296 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1297 CHECK(!val->result_ok);
1298 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1301 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1302 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1303 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1304 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1306 LDKMonitorEvent_HTLCEvent_class =
1307 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1308 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1309 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1310 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1311 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1312 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1313 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1314 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
1315 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1317 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1318 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1320 case LDKMonitorEvent_HTLCEvent: {
1321 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1322 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1323 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1324 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1325 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1327 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1328 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1329 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1330 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1331 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
1332 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
1337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1338 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1339 ret->datalen = (*env)->GetArrayLength(env, elems);
1340 if (ret->datalen == 0) {
1343 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1344 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1345 for (size_t i = 0; i < ret->datalen; i++) {
1346 int64_t arr_elem = java_elems[i];
1347 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1348 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1349 ret->data[i] = arr_elem_conv;
1351 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1353 return (uint64_t)ret;
1355 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1356 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1357 for (size_t i = 0; i < ret.datalen; i++) {
1358 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1362 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1363 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1364 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1365 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1367 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1368 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1369 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1370 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1371 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1372 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1373 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1374 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1375 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1376 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1378 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1379 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1381 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1382 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1383 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1385 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1386 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1391 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1392 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1393 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1394 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1395 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1396 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1398 LDKSpendableOutputDescriptor_StaticOutput_class =
1399 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1400 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1401 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1402 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1403 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1404 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1405 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1406 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1407 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1408 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1409 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1410 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1411 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1412 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1414 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1415 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1417 case LDKSpendableOutputDescriptor_StaticOutput: {
1418 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1419 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1420 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1421 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1422 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1423 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1425 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1426 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1427 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1428 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1429 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1430 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1432 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1433 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1434 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1435 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1436 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1437 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1443 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1444 ret->datalen = (*env)->GetArrayLength(env, elems);
1445 if (ret->datalen == 0) {
1448 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1449 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1450 for (size_t i = 0; i < ret->datalen; i++) {
1451 int64_t arr_elem = java_elems[i];
1452 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1453 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1454 ret->data[i] = arr_elem_conv;
1456 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1458 return (uint64_t)ret;
1460 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1461 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1462 for (size_t i = 0; i < ret.datalen; i++) {
1463 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1467 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1468 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1469 static jclass LDKErrorAction_IgnoreError_class = NULL;
1470 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1471 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1472 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1474 LDKErrorAction_DisconnectPeer_class =
1475 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1476 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1477 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1478 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1479 LDKErrorAction_IgnoreError_class =
1480 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1481 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1482 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1483 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1484 LDKErrorAction_SendErrorMessage_class =
1485 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1486 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1487 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1488 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1490 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1491 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1493 case LDKErrorAction_DisconnectPeer: {
1494 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1495 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1496 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1497 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1498 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1500 case LDKErrorAction_IgnoreError: {
1501 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1503 case LDKErrorAction_SendErrorMessage: {
1504 LDKErrorMessage msg_var = obj->send_error_message.msg;
1505 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1506 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1507 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1508 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1513 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1514 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1515 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1516 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1517 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1518 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
1520 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1521 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1522 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1523 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1524 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1525 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1526 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1527 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1528 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1529 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1530 LDKHTLCFailChannelUpdate_NodeFailure_class =
1531 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1532 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1533 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1534 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1536 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1537 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1539 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1540 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1541 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1542 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1543 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1544 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1546 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1547 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1549 case LDKHTLCFailChannelUpdate_NodeFailure: {
1550 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1551 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1552 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1557 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1558 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1559 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1560 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1561 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1562 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1563 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1564 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1565 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1566 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1567 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1568 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1569 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1570 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1571 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1572 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1573 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1574 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1575 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1576 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1577 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1578 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1579 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1580 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1581 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1582 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1583 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1584 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1585 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1586 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1587 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1588 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1589 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1590 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1591 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1592 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1593 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1594 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1596 LDKMessageSendEvent_SendAcceptChannel_class =
1597 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1598 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1599 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1600 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1601 LDKMessageSendEvent_SendOpenChannel_class =
1602 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1603 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1604 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1605 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1606 LDKMessageSendEvent_SendFundingCreated_class =
1607 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1608 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1609 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1610 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1611 LDKMessageSendEvent_SendFundingSigned_class =
1612 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1613 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1614 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1615 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1616 LDKMessageSendEvent_SendFundingLocked_class =
1617 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1618 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1619 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1620 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1621 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1622 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1623 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1624 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1625 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1626 LDKMessageSendEvent_UpdateHTLCs_class =
1627 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1628 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1629 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1630 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1631 LDKMessageSendEvent_SendRevokeAndACK_class =
1632 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1633 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1634 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1635 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1636 LDKMessageSendEvent_SendClosingSigned_class =
1637 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1638 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1639 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1640 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1641 LDKMessageSendEvent_SendShutdown_class =
1642 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1643 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1644 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1645 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1646 LDKMessageSendEvent_SendChannelReestablish_class =
1647 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1648 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1649 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1650 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1651 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1652 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1653 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1654 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1655 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1656 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1657 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1658 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1659 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1660 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1661 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1662 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1663 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1664 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1665 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1666 LDKMessageSendEvent_HandleError_class =
1667 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1668 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1669 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1670 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1671 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1672 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1673 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1674 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1675 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1676 LDKMessageSendEvent_SendChannelRangeQuery_class =
1677 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1678 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1679 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1680 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1681 LDKMessageSendEvent_SendShortIdsQuery_class =
1682 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1683 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1684 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1685 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1686 LDKMessageSendEvent_SendReplyChannelRange_class =
1687 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1688 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1689 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1690 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1692 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1693 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1695 case LDKMessageSendEvent_SendAcceptChannel: {
1696 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1697 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1698 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1699 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1700 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1701 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1702 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1704 case LDKMessageSendEvent_SendOpenChannel: {
1705 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1706 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1707 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1708 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1709 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1710 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1711 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1713 case LDKMessageSendEvent_SendFundingCreated: {
1714 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1715 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1716 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1717 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1718 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1719 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1720 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1722 case LDKMessageSendEvent_SendFundingSigned: {
1723 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1724 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1725 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1726 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1727 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1728 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1729 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1731 case LDKMessageSendEvent_SendFundingLocked: {
1732 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1733 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1734 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1735 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1736 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1737 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1738 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1740 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1741 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1742 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1743 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1744 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1745 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1746 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1747 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1749 case LDKMessageSendEvent_UpdateHTLCs: {
1750 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1751 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1752 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1753 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1754 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1755 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1756 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1758 case LDKMessageSendEvent_SendRevokeAndACK: {
1759 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1760 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1761 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1762 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1763 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1764 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1765 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1767 case LDKMessageSendEvent_SendClosingSigned: {
1768 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1769 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1770 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1771 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1772 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1773 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1774 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1776 case LDKMessageSendEvent_SendShutdown: {
1777 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1778 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1779 LDKShutdown msg_var = obj->send_shutdown.msg;
1780 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1781 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1782 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1783 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1785 case LDKMessageSendEvent_SendChannelReestablish: {
1786 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1787 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1788 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1789 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1790 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1791 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1792 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1794 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1795 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1796 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1797 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1798 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1799 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1800 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1801 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1802 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1803 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1805 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1806 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1807 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1808 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1809 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1810 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1812 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1813 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1814 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1815 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1816 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1817 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1819 case LDKMessageSendEvent_HandleError: {
1820 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1821 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1822 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1823 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1825 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1826 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1827 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1829 case LDKMessageSendEvent_SendChannelRangeQuery: {
1830 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1831 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1832 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1833 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1834 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1835 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1836 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1838 case LDKMessageSendEvent_SendShortIdsQuery: {
1839 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1840 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1841 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1842 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1843 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1844 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1845 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1847 case LDKMessageSendEvent_SendReplyChannelRange: {
1848 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1849 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1850 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1851 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1852 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1853 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1854 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1860 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1861 ret->datalen = (*env)->GetArrayLength(env, elems);
1862 if (ret->datalen == 0) {
1865 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1866 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1867 for (size_t i = 0; i < ret->datalen; i++) {
1868 int64_t arr_elem = java_elems[i];
1869 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1870 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1871 ret->data[i] = arr_elem_conv;
1873 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1875 return (uint64_t)ret;
1877 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1878 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1879 for (size_t i = 0; i < ret.datalen; i++) {
1880 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1885 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1888 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1889 CHECK(val->result_ok);
1890 LDKInitFeatures res_var = (*val->contents.result);
1891 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1892 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1893 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1897 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1898 CHECK(!val->result_ok);
1899 LDKDecodeError err_var = (*val->contents.err);
1900 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1901 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1902 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1906 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1909 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1910 CHECK(val->result_ok);
1911 LDKNodeFeatures res_var = (*val->contents.result);
1912 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1913 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1914 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1918 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1919 CHECK(!val->result_ok);
1920 LDKDecodeError err_var = (*val->contents.err);
1921 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1922 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1923 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1927 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1930 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1931 CHECK(val->result_ok);
1932 LDKChannelFeatures res_var = (*val->contents.result);
1933 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1934 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1935 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1939 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1940 CHECK(!val->result_ok);
1941 LDKDecodeError err_var = (*val->contents.err);
1942 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1943 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1944 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1948 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1951 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1952 CHECK(val->result_ok);
1953 LDKInvoiceFeatures res_var = (*val->contents.result);
1954 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1955 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1956 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1960 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1961 CHECK(!val->result_ok);
1962 LDKDecodeError err_var = (*val->contents.err);
1963 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1964 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1965 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1969 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1972 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1973 CHECK(val->result_ok);
1974 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1975 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1976 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1977 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1981 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1982 CHECK(!val->result_ok);
1983 LDKDecodeError err_var = (*val->contents.err);
1984 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1985 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1986 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1990 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1993 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1994 CHECK(val->result_ok);
1995 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1996 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1997 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1998 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2002 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2003 CHECK(!val->result_ok);
2004 LDKDecodeError err_var = (*val->contents.err);
2005 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2006 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2007 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2011 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2014 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2015 CHECK(val->result_ok);
2016 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2020 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2021 CHECK(!val->result_ok);
2022 LDKDecodeError err_var = (*val->contents.err);
2023 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2024 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2025 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2029 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2031 CHECK((*env)->GetArrayLength(env, a) == 64);
2032 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2034 LDKCVec_SignatureZ b_constr;
2035 b_constr.datalen = (*env)->GetArrayLength(env, b);
2036 if (b_constr.datalen > 0)
2037 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2039 b_constr.data = NULL;
2040 for (size_t i = 0; i < b_constr.datalen; i++) {
2041 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2042 LDKSignature b_conv_8_ref;
2043 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2044 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2045 b_constr.data[i] = b_conv_8_ref;
2048 return (uint64_t)ret;
2050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2051 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2052 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2053 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2056 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2057 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2058 LDKCVec_SignatureZ b_var = tuple->b;
2059 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2061 for (size_t i = 0; i < b_var.datalen; i++) {
2062 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2063 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2064 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2069 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2072 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2073 CHECK(val->result_ok);
2074 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2078 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2079 CHECK(!val->result_ok);
2080 return *val->contents.err;
2082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2083 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2086 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2087 CHECK(val->result_ok);
2088 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2089 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2093 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2094 CHECK(!val->result_ok);
2095 return *val->contents.err;
2097 typedef struct LDKBaseSign_JCalls {
2098 atomic_size_t refcnt;
2101 jmethodID get_per_commitment_point_meth;
2102 jmethodID release_commitment_secret_meth;
2103 jmethodID channel_keys_id_meth;
2104 jmethodID sign_counterparty_commitment_meth;
2105 jmethodID sign_holder_commitment_and_htlcs_meth;
2106 jmethodID sign_justice_revoked_output_meth;
2107 jmethodID sign_justice_revoked_htlc_meth;
2108 jmethodID sign_counterparty_htlc_transaction_meth;
2109 jmethodID sign_closing_transaction_meth;
2110 jmethodID sign_channel_announcement_meth;
2111 jmethodID ready_channel_meth;
2112 } LDKBaseSign_JCalls;
2113 static void LDKBaseSign_JCalls_free(void* this_arg) {
2114 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2115 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2117 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2118 if (get_jenv_res == JNI_EDETACHED) {
2119 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2121 DO_ASSERT(get_jenv_res == JNI_OK);
2123 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2124 if (get_jenv_res == JNI_EDETACHED) {
2125 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2130 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2131 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2133 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2134 if (get_jenv_res == JNI_EDETACHED) {
2135 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2137 DO_ASSERT(get_jenv_res == JNI_OK);
2139 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2141 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2142 if ((*env)->ExceptionCheck(env)) {
2143 (*env)->ExceptionDescribe(env);
2144 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2146 LDKPublicKey ret_ref;
2147 CHECK((*env)->GetArrayLength(env, ret) == 33);
2148 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2149 if (get_jenv_res == JNI_EDETACHED) {
2150 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2154 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2155 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2157 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2158 if (get_jenv_res == JNI_EDETACHED) {
2159 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2161 DO_ASSERT(get_jenv_res == JNI_OK);
2163 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2165 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2166 if ((*env)->ExceptionCheck(env)) {
2167 (*env)->ExceptionDescribe(env);
2168 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2170 LDKThirtyTwoBytes ret_ref;
2171 CHECK((*env)->GetArrayLength(env, ret) == 32);
2172 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2173 if (get_jenv_res == JNI_EDETACHED) {
2174 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2178 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2179 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2181 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2182 if (get_jenv_res == JNI_EDETACHED) {
2183 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2185 DO_ASSERT(get_jenv_res == JNI_OK);
2187 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2189 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2190 if ((*env)->ExceptionCheck(env)) {
2191 (*env)->ExceptionDescribe(env);
2192 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2194 LDKThirtyTwoBytes ret_ref;
2195 CHECK((*env)->GetArrayLength(env, ret) == 32);
2196 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2197 if (get_jenv_res == JNI_EDETACHED) {
2198 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2202 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2203 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2205 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2206 if (get_jenv_res == JNI_EDETACHED) {
2207 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2209 DO_ASSERT(get_jenv_res == JNI_OK);
2211 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2212 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2213 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2214 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2215 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2216 if (commitment_tx_var.is_owned) {
2217 commitment_tx_ref |= 1;
2219 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2221 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2222 if ((*env)->ExceptionCheck(env)) {
2223 (*env)->ExceptionDescribe(env);
2224 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2226 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2227 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2228 if (get_jenv_res == JNI_EDETACHED) {
2229 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2233 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2234 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2236 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2237 if (get_jenv_res == JNI_EDETACHED) {
2238 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2240 DO_ASSERT(get_jenv_res == JNI_OK);
2242 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2243 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2244 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2245 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2246 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2247 if (commitment_tx_var.is_owned) {
2248 commitment_tx_ref |= 1;
2250 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2252 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2253 if ((*env)->ExceptionCheck(env)) {
2254 (*env)->ExceptionDescribe(env);
2255 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2257 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2258 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((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_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
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 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2281 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);
2282 if ((*env)->ExceptionCheck(env)) {
2283 (*env)->ExceptionDescribe(env);
2284 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2286 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2287 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2288 if (get_jenv_res == JNI_EDETACHED) {
2289 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2293 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) {
2294 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2296 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2297 if (get_jenv_res == JNI_EDETACHED) {
2298 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2300 DO_ASSERT(get_jenv_res == JNI_OK);
2302 LDKTransaction justice_tx_var = justice_tx;
2303 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2304 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2305 Transaction_free(justice_tx_var);
2306 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2307 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2308 LDKHTLCOutputInCommitment htlc_var = *htlc;
2309 htlc_var = HTLCOutputInCommitment_clone(htlc);
2310 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2311 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2312 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2313 if (htlc_var.is_owned) {
2316 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2318 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);
2319 if ((*env)->ExceptionCheck(env)) {
2320 (*env)->ExceptionDescribe(env);
2321 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
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_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) {
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 htlc_tx_var = htlc_tx;
2340 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2341 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2342 Transaction_free(htlc_tx_var);
2343 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2344 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2345 LDKHTLCOutputInCommitment htlc_var = *htlc;
2346 htlc_var = HTLCOutputInCommitment_clone(htlc);
2347 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2348 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2349 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2350 if (htlc_var.is_owned) {
2353 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2355 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);
2356 if ((*env)->ExceptionCheck(env)) {
2357 (*env)->ExceptionDescribe(env);
2358 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2360 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2361 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2362 if (get_jenv_res == JNI_EDETACHED) {
2363 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2367 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2368 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2370 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2371 if (get_jenv_res == JNI_EDETACHED) {
2372 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2374 DO_ASSERT(get_jenv_res == JNI_OK);
2376 LDKTransaction closing_tx_var = closing_tx;
2377 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2378 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2379 Transaction_free(closing_tx_var);
2380 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2382 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2383 if ((*env)->ExceptionCheck(env)) {
2384 (*env)->ExceptionDescribe(env);
2385 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2387 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2388 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2389 if (get_jenv_res == JNI_EDETACHED) {
2390 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2394 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2395 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2397 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2398 if (get_jenv_res == JNI_EDETACHED) {
2399 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2401 DO_ASSERT(get_jenv_res == JNI_OK);
2403 LDKUnsignedChannelAnnouncement msg_var = *msg;
2404 msg_var = UnsignedChannelAnnouncement_clone(msg);
2405 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2406 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2407 uint64_t msg_ref = (uint64_t)msg_var.inner;
2408 if (msg_var.is_owned) {
2411 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2413 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2414 if ((*env)->ExceptionCheck(env)) {
2415 (*env)->ExceptionDescribe(env);
2416 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2418 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2419 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2420 if (get_jenv_res == JNI_EDETACHED) {
2421 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2425 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2426 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2428 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2429 if (get_jenv_res == JNI_EDETACHED) {
2430 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2432 DO_ASSERT(get_jenv_res == JNI_OK);
2434 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2435 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2436 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2437 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2438 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2439 if (channel_parameters_var.is_owned) {
2440 channel_parameters_ref |= 1;
2442 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2444 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2445 if ((*env)->ExceptionCheck(env)) {
2446 (*env)->ExceptionDescribe(env);
2447 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2449 if (get_jenv_res == JNI_EDETACHED) {
2450 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2453 static void* LDKBaseSign_JCalls_clone(const void* this_arg) {
2454 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2455 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2456 return (void*) this_arg;
2458 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2459 jclass c = (*env)->GetObjectClass(env, o);
2461 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2462 atomic_init(&calls->refcnt, 1);
2463 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2464 calls->o = (*env)->NewWeakGlobalRef(env, o);
2465 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2466 CHECK(calls->get_per_commitment_point_meth != NULL);
2467 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2468 CHECK(calls->release_commitment_secret_meth != NULL);
2469 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2470 CHECK(calls->channel_keys_id_meth != NULL);
2471 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2472 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2473 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2474 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2475 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2476 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2477 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2478 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2479 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2480 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2481 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2482 CHECK(calls->sign_closing_transaction_meth != NULL);
2483 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2484 CHECK(calls->sign_channel_announcement_meth != NULL);
2485 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2486 CHECK(calls->ready_channel_meth != NULL);
2488 LDKChannelPublicKeys pubkeys_conv;
2489 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2490 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2491 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2494 .this_arg = (void*) calls,
2495 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2496 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2497 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2498 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2499 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2500 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2501 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2502 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2503 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2504 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2505 .ready_channel = ready_channel_LDKBaseSign_jcall,
2506 .free = LDKBaseSign_JCalls_free,
2507 .pubkeys = pubkeys_conv,
2508 .set_pubkeys = NULL,
2512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2513 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2514 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2515 return (uint64_t)res_ptr;
2517 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) {
2518 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2519 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2520 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2525 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2526 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2527 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2532 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2533 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2534 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2538 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) {
2539 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2540 LDKCommitmentTransaction commitment_tx_conv;
2541 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2542 commitment_tx_conv.is_owned = false;
2543 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2544 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2545 return (uint64_t)ret_conv;
2548 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) {
2549 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2550 LDKHolderCommitmentTransaction commitment_tx_conv;
2551 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2552 commitment_tx_conv.is_owned = false;
2553 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2554 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2555 return (uint64_t)ret_conv;
2558 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) {
2559 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2560 LDKTransaction justice_tx_ref;
2561 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2562 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2563 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2564 justice_tx_ref.data_is_owned = true;
2565 unsigned char per_commitment_key_arr[32];
2566 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2567 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2568 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2569 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2570 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2571 return (uint64_t)ret_conv;
2574 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) {
2575 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2576 LDKTransaction justice_tx_ref;
2577 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2578 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2579 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2580 justice_tx_ref.data_is_owned = true;
2581 unsigned char per_commitment_key_arr[32];
2582 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2583 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2584 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2585 LDKHTLCOutputInCommitment htlc_conv;
2586 htlc_conv.inner = (void*)(htlc & (~1));
2587 htlc_conv.is_owned = false;
2588 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2589 *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);
2590 return (uint64_t)ret_conv;
2593 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) {
2594 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2595 LDKTransaction htlc_tx_ref;
2596 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2597 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2598 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2599 htlc_tx_ref.data_is_owned = true;
2600 LDKPublicKey per_commitment_point_ref;
2601 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2602 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2603 LDKHTLCOutputInCommitment htlc_conv;
2604 htlc_conv.inner = (void*)(htlc & (~1));
2605 htlc_conv.is_owned = false;
2606 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2607 *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);
2608 return (uint64_t)ret_conv;
2611 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) {
2612 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2613 LDKTransaction closing_tx_ref;
2614 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2615 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2616 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2617 closing_tx_ref.data_is_owned = true;
2618 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2619 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2620 return (uint64_t)ret_conv;
2623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2624 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2625 LDKUnsignedChannelAnnouncement msg_conv;
2626 msg_conv.inner = (void*)(msg & (~1));
2627 msg_conv.is_owned = false;
2628 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2629 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2630 return (uint64_t)ret_conv;
2633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2634 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2635 LDKChannelTransactionParameters channel_parameters_conv;
2636 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2637 channel_parameters_conv.is_owned = false;
2638 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2641 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2642 if (this_arg->set_pubkeys != NULL)
2643 this_arg->set_pubkeys(this_arg);
2644 return this_arg->pubkeys;
2646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2647 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2648 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2651 uint64_t ret_ref = (uint64_t)ret_var.inner;
2652 if (ret_var.is_owned) {
2658 typedef struct LDKSign_JCalls {
2659 atomic_size_t refcnt;
2662 LDKBaseSign_JCalls* BaseSign;
2663 jmethodID write_meth;
2665 static void LDKSign_JCalls_free(void* this_arg) {
2666 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2667 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2669 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2670 if (get_jenv_res == JNI_EDETACHED) {
2671 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2673 DO_ASSERT(get_jenv_res == JNI_OK);
2675 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2676 if (get_jenv_res == JNI_EDETACHED) {
2677 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2682 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2683 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2685 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2686 if (get_jenv_res == JNI_EDETACHED) {
2687 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2689 DO_ASSERT(get_jenv_res == JNI_OK);
2691 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2693 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2694 if ((*env)->ExceptionCheck(env)) {
2695 (*env)->ExceptionDescribe(env);
2696 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2698 LDKCVec_u8Z ret_ref;
2699 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2700 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2701 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2702 if (get_jenv_res == JNI_EDETACHED) {
2703 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2707 static void* LDKSign_JCalls_clone(const void* this_arg) {
2708 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2709 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2710 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2711 return (void*) this_arg;
2713 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2714 jclass c = (*env)->GetObjectClass(env, o);
2716 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2717 atomic_init(&calls->refcnt, 1);
2718 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2719 calls->o = (*env)->NewWeakGlobalRef(env, o);
2720 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2721 CHECK(calls->write_meth != NULL);
2723 LDKChannelPublicKeys pubkeys_conv;
2724 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2725 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2726 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2729 .this_arg = (void*) calls,
2730 .write = write_LDKSign_jcall,
2731 .clone = LDKSign_JCalls_clone,
2732 .free = LDKSign_JCalls_free,
2733 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2735 calls->BaseSign = ret.BaseSign.this_arg;
2738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2739 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2740 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2741 return (uint64_t)res_ptr;
2743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2744 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2745 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2746 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2747 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2748 CVec_u8Z_free(ret_var);
2752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2753 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2756 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2757 CHECK(val->result_ok);
2758 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2759 *ret = Sign_clone(&(*val->contents.result));
2760 return (uint64_t)ret;
2762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2763 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2764 CHECK(!val->result_ok);
2765 LDKDecodeError err_var = (*val->contents.err);
2766 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2767 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2768 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2772 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2774 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2775 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2776 CHECK(val->result_ok);
2777 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
2778 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
2781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2782 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2783 CHECK(!val->result_ok);
2784 return *val->contents.err;
2786 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2787 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2788 for (size_t i = 0; i < ret.datalen; i++) {
2789 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2793 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2794 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2796 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2797 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2798 CHECK(val->result_ok);
2799 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2800 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
2802 for (size_t i = 0; i < res_var.datalen; i++) {
2803 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
2804 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
2805 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
2806 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
2810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2811 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2812 CHECK(!val->result_ok);
2813 return *val->contents.err;
2815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2816 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2819 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2820 CHECK(val->result_ok);
2821 LDKInMemorySigner res_var = (*val->contents.result);
2822 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2823 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2824 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2828 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2829 CHECK(!val->result_ok);
2830 LDKDecodeError err_var = (*val->contents.err);
2831 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2832 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2833 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2837 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2838 ret->datalen = (*env)->GetArrayLength(env, elems);
2839 if (ret->datalen == 0) {
2842 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2843 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2844 for (size_t i = 0; i < ret->datalen; i++) {
2845 int64_t arr_elem = java_elems[i];
2846 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2847 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2848 ret->data[i] = arr_elem_conv;
2850 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2852 return (uint64_t)ret;
2854 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2855 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2856 for (size_t i = 0; i < ret.datalen; i++) {
2857 ret.data[i] = TxOut_clone(&orig->data[i]);
2861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2862 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2865 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2866 CHECK(val->result_ok);
2867 LDKTransaction res_var = (*val->contents.result);
2868 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
2869 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
2872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2873 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2874 CHECK(!val->result_ok);
2875 return *val->contents.err;
2877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2878 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2879 LDKThirtyTwoBytes a_ref;
2880 CHECK((*env)->GetArrayLength(env, a) == 32);
2881 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2883 LDKChannelMonitor b_conv;
2884 b_conv.inner = (void*)(b & (~1));
2885 b_conv.is_owned = (b & 1) || (b == 0);
2886 b_conv = ChannelMonitor_clone(&b_conv);
2888 return (uint64_t)ret;
2890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2891 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2892 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2893 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2897 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2898 LDKChannelMonitor b_var = tuple->b;
2899 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2900 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2901 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2905 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2906 ret->datalen = (*env)->GetArrayLength(env, elems);
2907 if (ret->datalen == 0) {
2910 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2911 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2912 for (size_t i = 0; i < ret->datalen; i++) {
2913 int64_t arr_elem = java_elems[i];
2914 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2915 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2916 ret->data[i] = arr_elem_conv;
2918 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2920 return (uint64_t)ret;
2922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2923 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2925 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2926 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2927 CHECK(val->result_ok);
2928 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2929 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
2930 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
2931 for (size_t i = 0; i < res_var.datalen; i++) {
2932 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
2933 res_arr_ptr[i] = res_conv_34_ref;
2935 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
2938 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2939 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2940 CHECK(!val->result_ok);
2941 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
2944 static jclass LDKAPIError_APIMisuseError_class = NULL;
2945 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2946 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2947 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2948 static jclass LDKAPIError_RouteError_class = NULL;
2949 static jmethodID LDKAPIError_RouteError_meth = NULL;
2950 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2951 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2952 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2953 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2955 LDKAPIError_APIMisuseError_class =
2956 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2957 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2958 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
2959 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2960 LDKAPIError_FeeRateTooHigh_class =
2961 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2962 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2963 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
2964 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2965 LDKAPIError_RouteError_class =
2966 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2967 CHECK(LDKAPIError_RouteError_class != NULL);
2968 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2969 CHECK(LDKAPIError_RouteError_meth != NULL);
2970 LDKAPIError_ChannelUnavailable_class =
2971 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2972 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2973 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
2974 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2975 LDKAPIError_MonitorUpdateFailed_class =
2976 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2977 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2978 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2979 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2981 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2982 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2984 case LDKAPIError_APIMisuseError: {
2985 LDKStr err_str = obj->api_misuse_error.err;
2986 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2987 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
2989 case LDKAPIError_FeeRateTooHigh: {
2990 LDKStr err_str = obj->fee_rate_too_high.err;
2991 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2992 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
2994 case LDKAPIError_RouteError: {
2995 LDKStr err_str = obj->route_error.err;
2996 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2997 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2999 case LDKAPIError_ChannelUnavailable: {
3000 LDKStr err_str = obj->channel_unavailable.err;
3001 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3002 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3004 case LDKAPIError_MonitorUpdateFailed: {
3005 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3011 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3014 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3015 CHECK(val->result_ok);
3016 return *val->contents.result;
3018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3019 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3020 CHECK(!val->result_ok);
3021 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3025 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3026 ret->datalen = (*env)->GetArrayLength(env, elems);
3027 if (ret->datalen == 0) {
3030 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3031 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3032 for (size_t i = 0; i < ret->datalen; i++) {
3033 int64_t arr_elem = java_elems[i];
3034 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3035 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3036 ret->data[i] = arr_elem_conv;
3038 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3040 return (uint64_t)ret;
3042 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3043 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3044 for (size_t i = 0; i < ret.datalen; i++) {
3045 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3050 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3051 ret->datalen = (*env)->GetArrayLength(env, elems);
3052 if (ret->datalen == 0) {
3055 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3056 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3057 for (size_t i = 0; i < ret->datalen; i++) {
3058 int64_t arr_elem = java_elems[i];
3059 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3060 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3061 ret->data[i] = arr_elem_conv;
3063 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3065 return (uint64_t)ret;
3067 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3068 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3069 for (size_t i = 0; i < ret.datalen; i++) {
3070 ret.data[i] = APIError_clone(&orig->data[i]);
3074 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3075 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3076 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3077 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3078 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3079 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3080 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3081 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3083 LDKPaymentSendFailure_ParameterError_class =
3084 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3085 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3086 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3087 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3088 LDKPaymentSendFailure_PathParameterError_class =
3089 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3090 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3091 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3092 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3093 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3094 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3095 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3096 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3097 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3098 LDKPaymentSendFailure_PartialFailure_class =
3099 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3100 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3101 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3102 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3104 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3105 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3107 case LDKPaymentSendFailure_ParameterError: {
3108 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3109 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3111 case LDKPaymentSendFailure_PathParameterError: {
3112 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3113 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3114 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3115 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3116 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3117 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3118 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3119 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3121 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3122 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3124 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3125 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3126 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3127 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3128 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3129 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3130 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3132 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3133 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3135 case LDKPaymentSendFailure_PartialFailure: {
3136 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3137 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3138 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3139 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3140 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3141 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3142 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3143 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3145 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3146 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3152 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3155 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3156 CHECK(val->result_ok);
3157 return *val->contents.result;
3159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3160 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3161 CHECK(!val->result_ok);
3162 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3165 static jclass LDKNetAddress_IPv4_class = NULL;
3166 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3167 static jclass LDKNetAddress_IPv6_class = NULL;
3168 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3169 static jclass LDKNetAddress_OnionV2_class = NULL;
3170 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3171 static jclass LDKNetAddress_OnionV3_class = NULL;
3172 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3174 LDKNetAddress_IPv4_class =
3175 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3176 CHECK(LDKNetAddress_IPv4_class != NULL);
3177 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3178 CHECK(LDKNetAddress_IPv4_meth != NULL);
3179 LDKNetAddress_IPv6_class =
3180 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3181 CHECK(LDKNetAddress_IPv6_class != NULL);
3182 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3183 CHECK(LDKNetAddress_IPv6_meth != NULL);
3184 LDKNetAddress_OnionV2_class =
3185 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3186 CHECK(LDKNetAddress_OnionV2_class != NULL);
3187 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3188 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3189 LDKNetAddress_OnionV3_class =
3190 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3191 CHECK(LDKNetAddress_OnionV3_class != NULL);
3192 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3193 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3195 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3196 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3198 case LDKNetAddress_IPv4: {
3199 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3200 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3201 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3203 case LDKNetAddress_IPv6: {
3204 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3205 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3206 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3208 case LDKNetAddress_OnionV2: {
3209 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3210 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3211 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3213 case LDKNetAddress_OnionV3: {
3214 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3215 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3216 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);
3221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3222 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3223 ret->datalen = (*env)->GetArrayLength(env, elems);
3224 if (ret->datalen == 0) {
3227 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3228 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3229 for (size_t i = 0; i < ret->datalen; i++) {
3230 int64_t arr_elem = java_elems[i];
3231 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3232 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3233 ret->data[i] = arr_elem_conv;
3235 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3237 return (uint64_t)ret;
3239 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3240 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3241 for (size_t i = 0; i < ret.datalen; i++) {
3242 ret.data[i] = NetAddress_clone(&orig->data[i]);
3246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3247 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3248 LDKThirtyTwoBytes a_ref;
3249 CHECK((*env)->GetArrayLength(env, a) == 32);
3250 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3252 LDKThirtyTwoBytes b_ref;
3253 CHECK((*env)->GetArrayLength(env, b) == 32);
3254 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3256 return (uint64_t)ret;
3258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3259 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3260 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3261 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3265 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3266 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3267 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3271 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3274 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3275 CHECK(val->result_ok);
3276 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3277 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3281 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3282 CHECK(!val->result_ok);
3283 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3287 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3288 ret->datalen = (*env)->GetArrayLength(env, elems);
3289 if (ret->datalen == 0) {
3292 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3293 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3294 for (size_t i = 0; i < ret->datalen; i++) {
3295 int64_t arr_elem = java_elems[i];
3296 LDKChannelMonitor arr_elem_conv;
3297 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3298 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3299 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3300 ret->data[i] = arr_elem_conv;
3302 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3304 return (uint64_t)ret;
3306 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3307 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3308 for (size_t i = 0; i < ret.datalen; i++) {
3309 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3313 typedef struct LDKWatch_JCalls {
3314 atomic_size_t refcnt;
3317 jmethodID watch_channel_meth;
3318 jmethodID update_channel_meth;
3319 jmethodID release_pending_monitor_events_meth;
3321 static void LDKWatch_JCalls_free(void* this_arg) {
3322 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3323 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3325 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3326 if (get_jenv_res == JNI_EDETACHED) {
3327 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3329 DO_ASSERT(get_jenv_res == JNI_OK);
3331 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3332 if (get_jenv_res == JNI_EDETACHED) {
3333 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3338 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3339 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3341 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3342 if (get_jenv_res == JNI_EDETACHED) {
3343 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3345 DO_ASSERT(get_jenv_res == JNI_OK);
3347 LDKOutPoint funding_txo_var = funding_txo;
3348 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3349 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3350 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3351 if (funding_txo_var.is_owned) {
3352 funding_txo_ref |= 1;
3354 LDKChannelMonitor monitor_var = monitor;
3355 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3356 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3357 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3358 if (monitor_var.is_owned) {
3361 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3363 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3364 if ((*env)->ExceptionCheck(env)) {
3365 (*env)->ExceptionDescribe(env);
3366 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3368 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3369 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3370 if (get_jenv_res == JNI_EDETACHED) {
3371 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3375 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3376 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3378 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3379 if (get_jenv_res == JNI_EDETACHED) {
3380 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3382 DO_ASSERT(get_jenv_res == JNI_OK);
3384 LDKOutPoint funding_txo_var = funding_txo;
3385 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3386 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3387 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3388 if (funding_txo_var.is_owned) {
3389 funding_txo_ref |= 1;
3391 LDKChannelMonitorUpdate update_var = update;
3392 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3393 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3394 uint64_t update_ref = (uint64_t)update_var.inner;
3395 if (update_var.is_owned) {
3398 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3400 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3401 if ((*env)->ExceptionCheck(env)) {
3402 (*env)->ExceptionDescribe(env);
3403 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3405 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3406 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3407 if (get_jenv_res == JNI_EDETACHED) {
3408 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3412 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3413 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3415 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3416 if (get_jenv_res == JNI_EDETACHED) {
3417 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3419 DO_ASSERT(get_jenv_res == JNI_OK);
3421 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3423 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3424 if ((*env)->ExceptionCheck(env)) {
3425 (*env)->ExceptionDescribe(env);
3426 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3428 LDKCVec_MonitorEventZ ret_constr;
3429 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3430 if (ret_constr.datalen > 0)
3431 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3433 ret_constr.data = NULL;
3434 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3435 for (size_t o = 0; o < ret_constr.datalen; o++) {
3436 int64_t ret_conv_14 = ret_vals[o];
3437 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3438 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3439 ret_constr.data[o] = ret_conv_14_conv;
3441 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3442 if (get_jenv_res == JNI_EDETACHED) {
3443 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3447 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3448 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3449 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3450 return (void*) this_arg;
3452 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3453 jclass c = (*env)->GetObjectClass(env, o);
3455 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3456 atomic_init(&calls->refcnt, 1);
3457 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3458 calls->o = (*env)->NewWeakGlobalRef(env, o);
3459 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3460 CHECK(calls->watch_channel_meth != NULL);
3461 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3462 CHECK(calls->update_channel_meth != NULL);
3463 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3464 CHECK(calls->release_pending_monitor_events_meth != NULL);
3467 .this_arg = (void*) calls,
3468 .watch_channel = watch_channel_LDKWatch_jcall,
3469 .update_channel = update_channel_LDKWatch_jcall,
3470 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3471 .free = LDKWatch_JCalls_free,
3475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3476 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3477 *res_ptr = LDKWatch_init(env, clz, o);
3478 return (uint64_t)res_ptr;
3480 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) {
3481 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3482 LDKOutPoint funding_txo_conv;
3483 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3484 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3485 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3486 LDKChannelMonitor monitor_conv;
3487 monitor_conv.inner = (void*)(monitor & (~1));
3488 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3489 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3490 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3491 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3492 return (uint64_t)ret_conv;
3495 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) {
3496 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3497 LDKOutPoint funding_txo_conv;
3498 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3499 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3500 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3501 LDKChannelMonitorUpdate update_conv;
3502 update_conv.inner = (void*)(update & (~1));
3503 update_conv.is_owned = (update & 1) || (update == 0);
3504 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3505 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3506 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3507 return (uint64_t)ret_conv;
3510 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3511 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3512 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3513 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3514 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3515 for (size_t o = 0; o < ret_var.datalen; o++) {
3516 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3517 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3518 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3519 ret_arr_ptr[o] = ret_conv_14_ref;
3521 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3526 typedef struct LDKBroadcasterInterface_JCalls {
3527 atomic_size_t refcnt;
3530 jmethodID broadcast_transaction_meth;
3531 } LDKBroadcasterInterface_JCalls;
3532 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3533 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3534 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3536 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3537 if (get_jenv_res == JNI_EDETACHED) {
3538 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3540 DO_ASSERT(get_jenv_res == JNI_OK);
3542 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3543 if (get_jenv_res == JNI_EDETACHED) {
3544 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3549 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3550 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3552 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3553 if (get_jenv_res == JNI_EDETACHED) {
3554 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3556 DO_ASSERT(get_jenv_res == JNI_OK);
3558 LDKTransaction tx_var = tx;
3559 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3560 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3561 Transaction_free(tx_var);
3562 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3564 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3565 if ((*env)->ExceptionCheck(env)) {
3566 (*env)->ExceptionDescribe(env);
3567 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3569 if (get_jenv_res == JNI_EDETACHED) {
3570 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3573 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3574 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3575 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3576 return (void*) this_arg;
3578 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3579 jclass c = (*env)->GetObjectClass(env, o);
3581 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3582 atomic_init(&calls->refcnt, 1);
3583 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3584 calls->o = (*env)->NewWeakGlobalRef(env, o);
3585 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3586 CHECK(calls->broadcast_transaction_meth != NULL);
3588 LDKBroadcasterInterface ret = {
3589 .this_arg = (void*) calls,
3590 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3591 .free = LDKBroadcasterInterface_JCalls_free,
3595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3596 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3597 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3598 return (uint64_t)res_ptr;
3600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3601 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3602 LDKTransaction tx_ref;
3603 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3604 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3605 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3606 tx_ref.data_is_owned = true;
3607 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3610 typedef struct LDKKeysInterface_JCalls {
3611 atomic_size_t refcnt;
3614 jmethodID get_node_secret_meth;
3615 jmethodID get_destination_script_meth;
3616 jmethodID get_shutdown_pubkey_meth;
3617 jmethodID get_channel_signer_meth;
3618 jmethodID get_secure_random_bytes_meth;
3619 jmethodID read_chan_signer_meth;
3620 jmethodID sign_invoice_meth;
3621 } LDKKeysInterface_JCalls;
3622 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3623 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3624 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3626 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3627 if (get_jenv_res == JNI_EDETACHED) {
3628 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3630 DO_ASSERT(get_jenv_res == JNI_OK);
3632 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3633 if (get_jenv_res == JNI_EDETACHED) {
3634 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3639 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3640 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3642 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3643 if (get_jenv_res == JNI_EDETACHED) {
3644 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3646 DO_ASSERT(get_jenv_res == JNI_OK);
3648 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3650 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3651 if ((*env)->ExceptionCheck(env)) {
3652 (*env)->ExceptionDescribe(env);
3653 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3655 LDKSecretKey ret_ref;
3656 CHECK((*env)->GetArrayLength(env, ret) == 32);
3657 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3658 if (get_jenv_res == JNI_EDETACHED) {
3659 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3663 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3664 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3666 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3667 if (get_jenv_res == JNI_EDETACHED) {
3668 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3670 DO_ASSERT(get_jenv_res == JNI_OK);
3672 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3674 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3675 if ((*env)->ExceptionCheck(env)) {
3676 (*env)->ExceptionDescribe(env);
3677 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3679 LDKCVec_u8Z ret_ref;
3680 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3681 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3682 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3683 if (get_jenv_res == JNI_EDETACHED) {
3684 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3688 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3689 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3691 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3692 if (get_jenv_res == JNI_EDETACHED) {
3693 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3695 DO_ASSERT(get_jenv_res == JNI_OK);
3697 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3699 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3700 if ((*env)->ExceptionCheck(env)) {
3701 (*env)->ExceptionDescribe(env);
3702 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3704 LDKPublicKey ret_ref;
3705 CHECK((*env)->GetArrayLength(env, ret) == 33);
3706 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3707 if (get_jenv_res == JNI_EDETACHED) {
3708 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3712 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3713 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3715 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3716 if (get_jenv_res == JNI_EDETACHED) {
3717 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3719 DO_ASSERT(get_jenv_res == JNI_OK);
3721 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3723 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3724 if ((*env)->ExceptionCheck(env)) {
3725 (*env)->ExceptionDescribe(env);
3726 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3728 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3729 ret_conv = Sign_clone(ret);
3730 if (get_jenv_res == JNI_EDETACHED) {
3731 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3735 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3736 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3738 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3739 if (get_jenv_res == JNI_EDETACHED) {
3740 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3742 DO_ASSERT(get_jenv_res == JNI_OK);
3744 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3746 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3747 if ((*env)->ExceptionCheck(env)) {
3748 (*env)->ExceptionDescribe(env);
3749 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3751 LDKThirtyTwoBytes ret_ref;
3752 CHECK((*env)->GetArrayLength(env, ret) == 32);
3753 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3754 if (get_jenv_res == JNI_EDETACHED) {
3755 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3759 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3760 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3762 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3763 if (get_jenv_res == JNI_EDETACHED) {
3764 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3766 DO_ASSERT(get_jenv_res == JNI_OK);
3768 LDKu8slice reader_var = reader;
3769 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3770 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3771 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3773 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3774 if ((*env)->ExceptionCheck(env)) {
3775 (*env)->ExceptionDescribe(env);
3776 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3778 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3779 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3780 if (get_jenv_res == JNI_EDETACHED) {
3781 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3785 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3786 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3788 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3789 if (get_jenv_res == JNI_EDETACHED) {
3790 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3792 DO_ASSERT(get_jenv_res == JNI_OK);
3794 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3795 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
3796 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
3797 CVec_u8Z_free(invoice_preimage_var);
3798 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3800 LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
3801 if ((*env)->ExceptionCheck(env)) {
3802 (*env)->ExceptionDescribe(env);
3803 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3805 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
3806 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
3807 if (get_jenv_res == JNI_EDETACHED) {
3808 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3812 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3813 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3814 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3815 return (void*) this_arg;
3817 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3818 jclass c = (*env)->GetObjectClass(env, o);
3820 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3821 atomic_init(&calls->refcnt, 1);
3822 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3823 calls->o = (*env)->NewWeakGlobalRef(env, o);
3824 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3825 CHECK(calls->get_node_secret_meth != NULL);
3826 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3827 CHECK(calls->get_destination_script_meth != NULL);
3828 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3829 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3830 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3831 CHECK(calls->get_channel_signer_meth != NULL);
3832 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3833 CHECK(calls->get_secure_random_bytes_meth != NULL);
3834 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3835 CHECK(calls->read_chan_signer_meth != NULL);
3836 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
3837 CHECK(calls->sign_invoice_meth != NULL);
3839 LDKKeysInterface ret = {
3840 .this_arg = (void*) calls,
3841 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3842 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3843 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
3844 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3845 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3846 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3847 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3848 .free = LDKKeysInterface_JCalls_free,
3852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3853 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3854 *res_ptr = LDKKeysInterface_init(env, clz, o);
3855 return (uint64_t)res_ptr;
3857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3858 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3859 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3860 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3865 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3866 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3867 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3868 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3869 CVec_u8Z_free(ret_var);
3873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
3874 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3875 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3876 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3880 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) {
3881 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3882 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3883 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3884 return (uint64_t)ret;
3887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3888 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3889 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3890 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3895 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3896 LDKu8slice reader_ref;
3897 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3898 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3899 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3900 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3901 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3902 return (uint64_t)ret_conv;
3905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
3906 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3907 LDKCVec_u8Z invoice_preimage_ref;
3908 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
3909 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3910 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
3911 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3912 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3913 return (uint64_t)ret_conv;
3916 typedef struct LDKFeeEstimator_JCalls {
3917 atomic_size_t refcnt;
3920 jmethodID get_est_sat_per_1000_weight_meth;
3921 } LDKFeeEstimator_JCalls;
3922 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3923 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3924 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3926 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3927 if (get_jenv_res == JNI_EDETACHED) {
3928 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3930 DO_ASSERT(get_jenv_res == JNI_OK);
3932 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3933 if (get_jenv_res == JNI_EDETACHED) {
3934 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3939 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3940 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3942 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3943 if (get_jenv_res == JNI_EDETACHED) {
3944 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3946 DO_ASSERT(get_jenv_res == JNI_OK);
3948 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3949 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3951 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3952 if ((*env)->ExceptionCheck(env)) {
3953 (*env)->ExceptionDescribe(env);
3954 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3956 if (get_jenv_res == JNI_EDETACHED) {
3957 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3961 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3962 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3963 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3964 return (void*) this_arg;
3966 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3967 jclass c = (*env)->GetObjectClass(env, o);
3969 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3970 atomic_init(&calls->refcnt, 1);
3971 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3972 calls->o = (*env)->NewWeakGlobalRef(env, o);
3973 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
3974 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3976 LDKFeeEstimator ret = {
3977 .this_arg = (void*) calls,
3978 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3979 .free = LDKFeeEstimator_JCalls_free,
3983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3984 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3985 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3986 return (uint64_t)res_ptr;
3988 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) {
3989 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3990 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3991 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3995 typedef struct LDKLogger_JCalls {
3996 atomic_size_t refcnt;
4001 static void LDKLogger_JCalls_free(void* this_arg) {
4002 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4003 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4005 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4006 if (get_jenv_res == JNI_EDETACHED) {
4007 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4009 DO_ASSERT(get_jenv_res == JNI_OK);
4011 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4012 if (get_jenv_res == JNI_EDETACHED) {
4013 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4018 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4019 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4021 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4022 if (get_jenv_res == JNI_EDETACHED) {
4023 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4025 DO_ASSERT(get_jenv_res == JNI_OK);
4027 const char* record_str = record;
4028 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4029 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4031 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4032 if ((*env)->ExceptionCheck(env)) {
4033 (*env)->ExceptionDescribe(env);
4034 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
4036 if (get_jenv_res == JNI_EDETACHED) {
4037 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4040 static void* LDKLogger_JCalls_clone(const void* this_arg) {
4041 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4042 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4043 return (void*) this_arg;
4045 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4046 jclass c = (*env)->GetObjectClass(env, o);
4048 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4049 atomic_init(&calls->refcnt, 1);
4050 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4051 calls->o = (*env)->NewWeakGlobalRef(env, o);
4052 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4053 CHECK(calls->log_meth != NULL);
4056 .this_arg = (void*) calls,
4057 .log = log_LDKLogger_jcall,
4058 .free = LDKLogger_JCalls_free,
4062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4063 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4064 *res_ptr = LDKLogger_init(env, clz, o);
4065 return (uint64_t)res_ptr;
4067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
4068 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4069 LDKThirtyTwoBytes a_ref;
4070 CHECK((*env)->GetArrayLength(env, a) == 32);
4071 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4073 LDKChannelManager b_conv;
4074 b_conv.inner = (void*)(b & (~1));
4075 b_conv.is_owned = (b & 1) || (b == 0);
4076 // Warning: we need a move here but no clone is available for LDKChannelManager
4078 return (uint64_t)ret;
4080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4081 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4082 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4083 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4087 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4088 LDKChannelManager b_var = tuple->b;
4089 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4090 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4091 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4095 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4098 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4099 CHECK(val->result_ok);
4100 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4104 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4105 CHECK(!val->result_ok);
4106 LDKDecodeError err_var = (*val->contents.err);
4107 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4108 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4109 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4112 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4113 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4116 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4117 CHECK(val->result_ok);
4118 LDKChannelConfig res_var = (*val->contents.result);
4119 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4120 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4121 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4125 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4126 CHECK(!val->result_ok);
4127 LDKDecodeError err_var = (*val->contents.err);
4128 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4129 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4130 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4134 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4137 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4138 CHECK(val->result_ok);
4139 LDKOutPoint res_var = (*val->contents.result);
4140 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4141 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4142 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4146 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4147 CHECK(!val->result_ok);
4148 LDKDecodeError err_var = (*val->contents.err);
4149 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4150 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4151 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4155 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4157 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4158 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4159 CHECK(val->result_ok);
4160 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4164 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4165 CHECK(!val->result_ok);
4166 return *val->contents.err;
4168 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4169 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4172 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4173 CHECK(val->result_ok);
4174 LDKInvoice res_var = (*val->contents.result);
4175 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4176 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4177 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4181 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4182 CHECK(!val->result_ok);
4183 return *val->contents.err;
4185 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4186 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4189 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4190 CHECK(val->result_ok);
4191 LDKSignedRawInvoice res_var = (*val->contents.result);
4192 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4193 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4194 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4198 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4199 CHECK(!val->result_ok);
4200 return *val->contents.err;
4202 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) {
4203 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4204 LDKRawInvoice a_conv;
4205 a_conv.inner = (void*)(a & (~1));
4206 a_conv.is_owned = (a & 1) || (a == 0);
4207 a_conv = RawInvoice_clone(&a_conv);
4209 LDKThirtyTwoBytes b_ref;
4210 CHECK((*env)->GetArrayLength(env, b) == 32);
4211 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4213 LDKInvoiceSignature c_conv;
4214 c_conv.inner = (void*)(c & (~1));
4215 c_conv.is_owned = (c & 1) || (c == 0);
4216 c_conv = InvoiceSignature_clone(&c_conv);
4218 return (uint64_t)ret;
4220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4221 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4222 LDKRawInvoice a_var = tuple->a;
4223 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4224 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4225 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4229 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4230 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4231 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4235 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4236 LDKInvoiceSignature c_var = tuple->c;
4237 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4238 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4239 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4242 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4243 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4246 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4247 CHECK(val->result_ok);
4248 LDKPayeePubKey res_var = (*val->contents.result);
4249 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4250 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4251 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4254 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4255 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4256 CHECK(!val->result_ok);
4257 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4261 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4262 ret->datalen = (*env)->GetArrayLength(env, elems);
4263 if (ret->datalen == 0) {
4266 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4267 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4268 for (size_t i = 0; i < ret->datalen; i++) {
4269 int64_t arr_elem = java_elems[i];
4270 LDKPrivateRoute arr_elem_conv;
4271 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4272 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4273 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4274 ret->data[i] = arr_elem_conv;
4276 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4278 return (uint64_t)ret;
4280 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4281 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4282 for (size_t i = 0; i < ret.datalen; i++) {
4283 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4288 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4291 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4292 CHECK(val->result_ok);
4293 LDKPositiveTimestamp res_var = (*val->contents.result);
4294 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4295 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4296 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4299 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4300 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4301 CHECK(!val->result_ok);
4302 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4306 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4309 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4310 CHECK(val->result_ok);
4311 return *val->contents.result;
4313 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4314 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4315 CHECK(!val->result_ok);
4316 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4320 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4323 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4324 CHECK(val->result_ok);
4325 LDKInvoice res_var = (*val->contents.result);
4326 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4327 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4328 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4331 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4332 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4333 CHECK(!val->result_ok);
4334 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4338 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4341 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4342 CHECK(val->result_ok);
4343 LDKDescription res_var = (*val->contents.result);
4344 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4345 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4346 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4349 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4350 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4351 CHECK(!val->result_ok);
4352 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4355 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4356 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4359 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4360 CHECK(val->result_ok);
4361 LDKExpiryTime res_var = (*val->contents.result);
4362 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4363 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4364 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4367 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4368 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4369 CHECK(!val->result_ok);
4370 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4374 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4377 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4378 CHECK(val->result_ok);
4379 LDKPrivateRoute res_var = (*val->contents.result);
4380 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4381 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4382 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4385 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4386 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4387 CHECK(!val->result_ok);
4388 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4392 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4394 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4395 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4396 CHECK(val->result_ok);
4397 LDKStr res_str = (*val->contents.result);
4398 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4401 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4402 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4403 CHECK(!val->result_ok);
4404 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4408 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4411 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4412 CHECK(val->result_ok);
4413 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4414 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4415 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4416 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4420 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4421 CHECK(!val->result_ok);
4422 LDKDecodeError err_var = (*val->contents.err);
4423 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4424 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4425 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4428 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4429 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4432 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4433 CHECK(val->result_ok);
4434 LDKHTLCUpdate res_var = (*val->contents.result);
4435 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4436 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4437 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4441 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4442 CHECK(!val->result_ok);
4443 LDKDecodeError err_var = (*val->contents.err);
4444 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4445 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4446 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4450 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4453 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4454 CHECK(val->result_ok);
4455 return *val->contents.result;
4457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4458 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4459 CHECK(!val->result_ok);
4460 LDKMonitorUpdateError err_var = (*val->contents.err);
4461 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4462 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4463 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4467 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4469 a_conv.inner = (void*)(a & (~1));
4470 a_conv.is_owned = (a & 1) || (a == 0);
4471 a_conv = OutPoint_clone(&a_conv);
4474 b_ref.datalen = (*env)->GetArrayLength(env, b);
4475 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4476 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4478 return (uint64_t)ret;
4480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4481 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4482 LDKOutPoint a_var = tuple->a;
4483 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4484 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4485 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4489 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4490 LDKCVec_u8Z b_var = tuple->b;
4491 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4492 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4496 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4499 b_ref.datalen = (*env)->GetArrayLength(env, b);
4500 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4501 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4503 return (uint64_t)ret;
4505 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4506 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4509 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4510 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4511 LDKCVec_u8Z b_var = tuple->b;
4512 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4513 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4517 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4518 ret->datalen = (*env)->GetArrayLength(env, elems);
4519 if (ret->datalen == 0) {
4522 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
4523 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4524 for (size_t i = 0; i < ret->datalen; i++) {
4525 int64_t arr_elem = java_elems[i];
4526 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
4527 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
4528 ret->data[i] = arr_elem_conv;
4530 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4532 return (uint64_t)ret;
4534 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4535 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4536 for (size_t i = 0; i < ret.datalen; i++) {
4537 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4542 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
4543 LDKThirtyTwoBytes a_ref;
4544 CHECK((*env)->GetArrayLength(env, a) == 32);
4545 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4547 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
4548 b_constr.datalen = (*env)->GetArrayLength(env, b);
4549 if (b_constr.datalen > 0)
4550 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
4552 b_constr.data = NULL;
4553 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4554 for (size_t b = 0; b < b_constr.datalen; b++) {
4555 int64_t b_conv_27 = b_vals[b];
4556 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
4557 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
4558 b_constr.data[b] = b_conv_27_conv;
4560 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4562 return (uint64_t)ret;
4564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4565 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4566 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4567 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4570 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4571 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4572 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
4573 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4574 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4575 for (size_t b = 0; b < b_var.datalen; b++) {
4576 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
4577 b_arr_ptr[b] = b_conv_27_ref;
4579 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4583 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
4584 ret->datalen = (*env)->GetArrayLength(env, elems);
4585 if (ret->datalen == 0) {
4588 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
4589 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4590 for (size_t i = 0; i < ret->datalen; i++) {
4591 int64_t arr_elem = java_elems[i];
4592 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
4593 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
4594 ret->data[i] = arr_elem_conv;
4596 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4598 return (uint64_t)ret;
4600 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4601 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 };
4602 for (size_t i = 0; i < ret.datalen; i++) {
4603 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4607 static jclass LDKEvent_FundingGenerationReady_class = NULL;
4608 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
4609 static jclass LDKEvent_PaymentReceived_class = NULL;
4610 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
4611 static jclass LDKEvent_PaymentSent_class = NULL;
4612 static jmethodID LDKEvent_PaymentSent_meth = NULL;
4613 static jclass LDKEvent_PaymentFailed_class = NULL;
4614 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
4615 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
4616 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
4617 static jclass LDKEvent_SpendableOutputs_class = NULL;
4618 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
4619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
4620 LDKEvent_FundingGenerationReady_class =
4621 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
4622 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
4623 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
4624 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
4625 LDKEvent_PaymentReceived_class =
4626 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
4627 CHECK(LDKEvent_PaymentReceived_class != NULL);
4628 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[B[BJJ)V");
4629 CHECK(LDKEvent_PaymentReceived_meth != NULL);
4630 LDKEvent_PaymentSent_class =
4631 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
4632 CHECK(LDKEvent_PaymentSent_class != NULL);
4633 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
4634 CHECK(LDKEvent_PaymentSent_meth != NULL);
4635 LDKEvent_PaymentFailed_class =
4636 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
4637 CHECK(LDKEvent_PaymentFailed_class != NULL);
4638 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
4639 CHECK(LDKEvent_PaymentFailed_meth != NULL);
4640 LDKEvent_PendingHTLCsForwardable_class =
4641 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
4642 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
4643 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
4644 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
4645 LDKEvent_SpendableOutputs_class =
4646 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
4647 CHECK(LDKEvent_SpendableOutputs_class != NULL);
4648 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
4649 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
4651 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4652 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
4654 case LDKEvent_FundingGenerationReady: {
4655 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
4656 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
4657 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4658 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
4659 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
4660 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);
4662 case LDKEvent_PaymentReceived: {
4663 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4664 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
4665 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4666 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_received.payment_preimage.data);
4667 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
4668 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
4669 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);
4671 case LDKEvent_PaymentSent: {
4672 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4673 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
4674 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
4676 case LDKEvent_PaymentFailed: {
4677 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4678 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
4679 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
4681 case LDKEvent_PendingHTLCsForwardable: {
4682 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
4684 case LDKEvent_SpendableOutputs: {
4685 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4686 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
4687 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
4688 for (size_t b = 0; b < outputs_var.datalen; b++) {
4689 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
4690 outputs_arr_ptr[b] = outputs_conv_27_ref;
4692 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
4693 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
4698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4699 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
4700 ret->datalen = (*env)->GetArrayLength(env, elems);
4701 if (ret->datalen == 0) {
4704 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
4705 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4706 for (size_t i = 0; i < ret->datalen; i++) {
4707 int64_t arr_elem = java_elems[i];
4708 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
4709 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
4710 ret->data[i] = arr_elem_conv;
4712 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4714 return (uint64_t)ret;
4716 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4717 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4718 for (size_t i = 0; i < ret.datalen; i++) {
4719 ret.data[i] = Event_clone(&orig->data[i]);
4723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
4724 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4726 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
4727 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
4729 return (uint64_t)ret;
4731 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4732 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4736 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4737 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
4738 return (uint64_t)b_ref;
4740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4741 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
4742 ret->datalen = (*env)->GetArrayLength(env, elems);
4743 if (ret->datalen == 0) {
4746 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
4747 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4748 for (size_t i = 0; i < ret->datalen; i++) {
4749 int64_t arr_elem = java_elems[i];
4750 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
4751 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
4752 ret->data[i] = arr_elem_conv;
4754 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4756 return (uint64_t)ret;
4758 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4759 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4760 for (size_t i = 0; i < ret.datalen; i++) {
4761 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4766 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4767 LDKThirtyTwoBytes a_ref;
4768 CHECK((*env)->GetArrayLength(env, a) == 32);
4769 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4771 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4772 b_constr.datalen = (*env)->GetArrayLength(env, b);
4773 if (b_constr.datalen > 0)
4774 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4776 b_constr.data = NULL;
4777 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4778 for (size_t a = 0; a < b_constr.datalen; a++) {
4779 int64_t b_conv_26 = b_vals[a];
4780 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
4781 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
4782 b_constr.data[a] = b_conv_26_conv;
4784 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4786 return (uint64_t)ret;
4788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4789 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4790 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4791 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4794 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4795 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4796 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
4797 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4798 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4799 for (size_t a = 0; a < b_var.datalen; a++) {
4800 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
4801 b_arr_ptr[a] = b_conv_26_ref;
4803 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4807 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
4808 ret->datalen = (*env)->GetArrayLength(env, elems);
4809 if (ret->datalen == 0) {
4812 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
4813 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4814 for (size_t i = 0; i < ret->datalen; i++) {
4815 int64_t arr_elem = java_elems[i];
4816 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
4817 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
4818 ret->data[i] = arr_elem_conv;
4820 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4822 return (uint64_t)ret;
4824 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
4825 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 };
4826 for (size_t i = 0; i < ret.datalen; i++) {
4827 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
4831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4832 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
4834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4835 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4836 CHECK(val->result_ok);
4837 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4841 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4842 CHECK(!val->result_ok);
4843 LDKDecodeError err_var = (*val->contents.err);
4844 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4845 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4846 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4850 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4853 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4854 CHECK(val->result_ok);
4855 return *val->contents.result;
4857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4858 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4859 CHECK(!val->result_ok);
4860 LDKLightningError err_var = (*val->contents.err);
4861 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4862 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4863 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4866 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) {
4867 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4868 LDKChannelAnnouncement a_conv;
4869 a_conv.inner = (void*)(a & (~1));
4870 a_conv.is_owned = (a & 1) || (a == 0);
4871 a_conv = ChannelAnnouncement_clone(&a_conv);
4873 LDKChannelUpdate b_conv;
4874 b_conv.inner = (void*)(b & (~1));
4875 b_conv.is_owned = (b & 1) || (b == 0);
4876 b_conv = ChannelUpdate_clone(&b_conv);
4878 LDKChannelUpdate c_conv;
4879 c_conv.inner = (void*)(c & (~1));
4880 c_conv.is_owned = (c & 1) || (c == 0);
4881 c_conv = ChannelUpdate_clone(&c_conv);
4883 return (uint64_t)ret;
4885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4886 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4887 LDKChannelAnnouncement a_var = tuple->a;
4888 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4889 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4890 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4894 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4895 LDKChannelUpdate b_var = tuple->b;
4896 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4897 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4898 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4902 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4903 LDKChannelUpdate c_var = tuple->c;
4904 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4905 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4906 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4910 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4911 ret->datalen = (*env)->GetArrayLength(env, elems);
4912 if (ret->datalen == 0) {
4915 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4916 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4917 for (size_t i = 0; i < ret->datalen; i++) {
4918 int64_t arr_elem = java_elems[i];
4919 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
4920 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4921 ret->data[i] = arr_elem_conv;
4923 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4925 return (uint64_t)ret;
4927 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4928 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4929 for (size_t i = 0; i < ret.datalen; i++) {
4930 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4935 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4936 ret->datalen = (*env)->GetArrayLength(env, elems);
4937 if (ret->datalen == 0) {
4940 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4941 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4942 for (size_t i = 0; i < ret->datalen; i++) {
4943 int64_t arr_elem = java_elems[i];
4944 LDKNodeAnnouncement arr_elem_conv;
4945 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4946 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4947 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4948 ret->data[i] = arr_elem_conv;
4950 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4952 return (uint64_t)ret;
4954 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4955 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4956 for (size_t i = 0; i < ret.datalen; i++) {
4957 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4962 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4965 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4966 CHECK(val->result_ok);
4967 return *val->contents.result;
4969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4970 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4971 CHECK(!val->result_ok);
4972 LDKLightningError err_var = (*val->contents.err);
4973 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4974 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4975 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4978 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4979 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4982 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4983 CHECK(val->result_ok);
4984 LDKCVec_u8Z res_var = (*val->contents.result);
4985 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
4986 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
4989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4990 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4991 CHECK(!val->result_ok);
4992 LDKPeerHandleError err_var = (*val->contents.err);
4993 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4994 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4995 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4999 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
5001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5002 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5003 CHECK(val->result_ok);
5004 return *val->contents.result;
5006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5007 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5008 CHECK(!val->result_ok);
5009 LDKPeerHandleError err_var = (*val->contents.err);
5010 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5011 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5012 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5016 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
5018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5019 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5020 CHECK(val->result_ok);
5021 return *val->contents.result;
5023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5024 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5025 CHECK(!val->result_ok);
5026 LDKPeerHandleError err_var = (*val->contents.err);
5027 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5028 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5029 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5033 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
5035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5036 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5037 CHECK(val->result_ok);
5038 LDKDirectionalChannelInfo res_var = (*val->contents.result);
5039 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5040 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5041 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5045 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5046 CHECK(!val->result_ok);
5047 LDKDecodeError err_var = (*val->contents.err);
5048 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5049 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5050 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5054 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
5056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5057 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5058 CHECK(val->result_ok);
5059 LDKChannelInfo res_var = (*val->contents.result);
5060 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5061 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5062 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5066 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5067 CHECK(!val->result_ok);
5068 LDKDecodeError err_var = (*val->contents.err);
5069 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5070 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5071 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5075 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
5077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5078 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5079 CHECK(val->result_ok);
5080 LDKRoutingFees res_var = (*val->contents.result);
5081 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5082 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5083 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5087 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5088 CHECK(!val->result_ok);
5089 LDKDecodeError err_var = (*val->contents.err);
5090 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5091 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5092 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5096 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
5098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5099 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5100 CHECK(val->result_ok);
5101 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
5102 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5103 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5104 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5108 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5109 CHECK(!val->result_ok);
5110 LDKDecodeError err_var = (*val->contents.err);
5111 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5112 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5113 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5117 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5118 ret->datalen = (*env)->GetArrayLength(env, elems);
5119 if (ret->datalen == 0) {
5122 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5123 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5124 for (size_t i = 0; i < ret->datalen; i++) {
5125 ret->data[i] = java_elems[i];
5127 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5129 return (uint64_t)ret;
5131 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5132 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5133 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5137 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
5139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5140 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5141 CHECK(val->result_ok);
5142 LDKNodeInfo res_var = (*val->contents.result);
5143 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5144 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5145 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5149 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5150 CHECK(!val->result_ok);
5151 LDKDecodeError err_var = (*val->contents.err);
5152 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5153 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5154 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5158 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
5160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5161 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5162 CHECK(val->result_ok);
5163 LDKNetworkGraph res_var = (*val->contents.result);
5164 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5165 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5166 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5170 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5171 CHECK(!val->result_ok);
5172 LDKDecodeError err_var = (*val->contents.err);
5173 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5174 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5175 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5179 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
5181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5182 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5183 CHECK(val->result_ok);
5184 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5187 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5188 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5189 CHECK(!val->result_ok);
5190 return *val->contents.err;
5192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5193 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
5195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5196 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5197 CHECK(val->result_ok);
5198 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5199 *res_conv = (*val->contents.result);
5200 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
5201 return (uint64_t)res_conv;
5203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5204 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5205 CHECK(!val->result_ok);
5206 LDKDecodeError err_var = (*val->contents.err);
5207 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5208 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5209 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5213 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
5215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5216 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5217 CHECK(val->result_ok);
5218 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5222 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5223 CHECK(!val->result_ok);
5224 LDKDecodeError err_var = (*val->contents.err);
5225 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5226 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5227 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5231 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
5232 ret->datalen = (*env)->GetArrayLength(env, elems);
5233 if (ret->datalen == 0) {
5236 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
5237 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5238 for (size_t i = 0; i < ret->datalen; i++) {
5239 int64_t arr_elem = java_elems[i];
5240 LDKUpdateAddHTLC arr_elem_conv;
5241 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5242 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5243 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
5244 ret->data[i] = arr_elem_conv;
5246 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5248 return (uint64_t)ret;
5250 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
5251 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
5252 for (size_t i = 0; i < ret.datalen; i++) {
5253 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
5257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5258 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
5259 ret->datalen = (*env)->GetArrayLength(env, elems);
5260 if (ret->datalen == 0) {
5263 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
5264 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5265 for (size_t i = 0; i < ret->datalen; i++) {
5266 int64_t arr_elem = java_elems[i];
5267 LDKUpdateFulfillHTLC arr_elem_conv;
5268 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5269 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5270 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
5271 ret->data[i] = arr_elem_conv;
5273 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5275 return (uint64_t)ret;
5277 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
5278 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
5279 for (size_t i = 0; i < ret.datalen; i++) {
5280 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
5284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5285 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
5286 ret->datalen = (*env)->GetArrayLength(env, elems);
5287 if (ret->datalen == 0) {
5290 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
5291 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5292 for (size_t i = 0; i < ret->datalen; i++) {
5293 int64_t arr_elem = java_elems[i];
5294 LDKUpdateFailHTLC arr_elem_conv;
5295 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5296 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5297 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
5298 ret->data[i] = arr_elem_conv;
5300 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5302 return (uint64_t)ret;
5304 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
5305 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
5306 for (size_t i = 0; i < ret.datalen; i++) {
5307 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
5311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5312 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
5313 ret->datalen = (*env)->GetArrayLength(env, elems);
5314 if (ret->datalen == 0) {
5317 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
5318 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5319 for (size_t i = 0; i < ret->datalen; i++) {
5320 int64_t arr_elem = java_elems[i];
5321 LDKUpdateFailMalformedHTLC arr_elem_conv;
5322 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5323 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5324 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
5325 ret->data[i] = arr_elem_conv;
5327 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5329 return (uint64_t)ret;
5331 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
5332 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
5333 for (size_t i = 0; i < ret.datalen; i++) {
5334 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
5338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5339 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
5341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5342 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5343 CHECK(val->result_ok);
5344 LDKAcceptChannel 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_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5351 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(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_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5360 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
5362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5363 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5364 CHECK(val->result_ok);
5365 LDKAnnouncementSignatures 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_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5372 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(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_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5381 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
5383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5384 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5385 CHECK(val->result_ok);
5386 LDKChannelReestablish 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_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5393 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(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_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5402 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
5404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5405 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5406 CHECK(val->result_ok);
5407 LDKClosingSigned 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_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5414 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(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_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5423 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
5425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5426 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5427 CHECK(val->result_ok);
5428 LDKCommitmentSigned 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_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5435 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(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_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5444 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
5446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5447 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5448 CHECK(val->result_ok);
5449 LDKFundingCreated 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_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5456 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(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_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5465 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
5467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5468 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5469 CHECK(val->result_ok);
5470 LDKFundingSigned 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_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5477 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(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_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5486 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
5488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5489 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5490 CHECK(val->result_ok);
5491 LDKFundingLocked 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_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5498 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(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_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5507 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
5509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5510 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5511 CHECK(val->result_ok);
5512 LDKInit 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_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5519 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(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_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5528 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
5530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5531 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5532 CHECK(val->result_ok);
5533 LDKOpenChannel 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_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5540 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(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_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5549 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5552 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5553 CHECK(val->result_ok);
5554 LDKRevokeAndACK 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_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5561 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(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_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5570 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5573 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5574 CHECK(val->result_ok);
5575 LDKShutdown 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_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5582 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(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_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5591 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5594 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5595 CHECK(val->result_ok);
5596 LDKUpdateFailHTLC 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_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5603 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(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_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5612 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5615 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5616 CHECK(val->result_ok);
5617 LDKUpdateFailMalformedHTLC 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_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5624 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(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_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5633 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5636 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5637 CHECK(val->result_ok);
5638 LDKUpdateFee 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_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5645 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(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_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5654 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5657 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5658 CHECK(val->result_ok);
5659 LDKUpdateFulfillHTLC 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_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5666 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(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_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5675 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5678 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5679 CHECK(val->result_ok);
5680 LDKUpdateAddHTLC 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_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5687 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(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_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5696 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5699 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5700 CHECK(val->result_ok);
5701 LDKPing 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_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5708 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(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_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5717 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5720 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5721 CHECK(val->result_ok);
5722 LDKPong 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_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5729 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(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_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5738 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5741 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5742 CHECK(val->result_ok);
5743 LDKUnsignedChannelAnnouncement 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_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5750 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(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_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5759 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5762 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5763 CHECK(val->result_ok);
5764 LDKChannelAnnouncement 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_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5771 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(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_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5780 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5783 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5784 CHECK(val->result_ok);
5785 LDKUnsignedChannelUpdate 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_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5792 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(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_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5801 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5804 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5805 CHECK(val->result_ok);
5806 LDKChannelUpdate 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_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5813 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(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_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5822 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5825 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5826 CHECK(val->result_ok);
5827 LDKErrorMessage 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_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5834 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(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_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5843 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5846 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5847 CHECK(val->result_ok);
5848 LDKUnsignedNodeAnnouncement 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_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5855 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(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_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5864 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5867 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5868 CHECK(val->result_ok);
5869 LDKNodeAnnouncement 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_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5876 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(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 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5885 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5888 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5889 CHECK(val->result_ok);
5890 LDKQueryShortChannelIds res_var = (*val->contents.result);
5891 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5892 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5893 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5897 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5898 CHECK(!val->result_ok);
5899 LDKDecodeError err_var = (*val->contents.err);
5900 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5901 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5902 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5906 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5909 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5910 CHECK(val->result_ok);
5911 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5912 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5913 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5914 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5918 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5919 CHECK(!val->result_ok);
5920 LDKDecodeError err_var = (*val->contents.err);
5921 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5922 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5923 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5927 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5930 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5931 CHECK(val->result_ok);
5932 LDKQueryChannelRange res_var = (*val->contents.result);
5933 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5934 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5935 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5939 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5940 CHECK(!val->result_ok);
5941 LDKDecodeError err_var = (*val->contents.err);
5942 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5943 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5944 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5948 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5951 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5952 CHECK(val->result_ok);
5953 LDKReplyChannelRange res_var = (*val->contents.result);
5954 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5955 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5956 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5960 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5961 CHECK(!val->result_ok);
5962 LDKDecodeError err_var = (*val->contents.err);
5963 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5964 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5965 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5969 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5972 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5973 CHECK(val->result_ok);
5974 LDKGossipTimestampFilter res_var = (*val->contents.result);
5975 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5976 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5977 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5981 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5982 CHECK(!val->result_ok);
5983 LDKDecodeError err_var = (*val->contents.err);
5984 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5985 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5986 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5989 static jclass LDKSignOrCreationError_SignError_class = NULL;
5990 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
5991 static jclass LDKSignOrCreationError_CreationError_class = NULL;
5992 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
5993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
5994 LDKSignOrCreationError_SignError_class =
5995 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
5996 CHECK(LDKSignOrCreationError_SignError_class != NULL);
5997 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
5998 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
5999 LDKSignOrCreationError_CreationError_class =
6000 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
6001 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
6002 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
6003 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
6005 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6006 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
6008 case LDKSignOrCreationError_SignError: {
6009 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
6011 case LDKSignOrCreationError_CreationError: {
6012 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
6013 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
6018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6019 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
6021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6022 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6023 CHECK(val->result_ok);
6024 LDKInvoice res_var = (*val->contents.result);
6025 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6026 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6027 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6031 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6032 CHECK(!val->result_ok);
6033 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
6036 typedef struct LDKMessageSendEventsProvider_JCalls {
6037 atomic_size_t refcnt;
6040 jmethodID get_and_clear_pending_msg_events_meth;
6041 } LDKMessageSendEventsProvider_JCalls;
6042 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
6043 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6044 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6046 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6047 if (get_jenv_res == JNI_EDETACHED) {
6048 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6050 DO_ASSERT(get_jenv_res == JNI_OK);
6052 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6053 if (get_jenv_res == JNI_EDETACHED) {
6054 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6059 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
6060 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6062 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6063 if (get_jenv_res == JNI_EDETACHED) {
6064 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6066 DO_ASSERT(get_jenv_res == JNI_OK);
6068 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6070 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
6071 if ((*env)->ExceptionCheck(env)) {
6072 (*env)->ExceptionDescribe(env);
6073 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6075 LDKCVec_MessageSendEventZ ret_constr;
6076 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6077 if (ret_constr.datalen > 0)
6078 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6080 ret_constr.data = NULL;
6081 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6082 for (size_t s = 0; s < ret_constr.datalen; s++) {
6083 int64_t ret_conv_18 = ret_vals[s];
6084 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
6085 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
6086 ret_constr.data[s] = ret_conv_18_conv;
6088 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6089 if (get_jenv_res == JNI_EDETACHED) {
6090 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6094 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
6095 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6096 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6097 return (void*) this_arg;
6099 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6100 jclass c = (*env)->GetObjectClass(env, o);
6102 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
6103 atomic_init(&calls->refcnt, 1);
6104 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6105 calls->o = (*env)->NewWeakGlobalRef(env, o);
6106 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
6107 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
6109 LDKMessageSendEventsProvider ret = {
6110 .this_arg = (void*) calls,
6111 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6112 .free = LDKMessageSendEventsProvider_JCalls_free,
6116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6117 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6118 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
6119 return (uint64_t)res_ptr;
6121 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6122 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
6123 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6124 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6125 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6126 for (size_t s = 0; s < ret_var.datalen; s++) {
6127 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6128 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
6129 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6130 ret_arr_ptr[s] = ret_conv_18_ref;
6132 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6137 typedef struct LDKEventHandler_JCalls {
6138 atomic_size_t refcnt;
6141 jmethodID handle_event_meth;
6142 } LDKEventHandler_JCalls;
6143 static void LDKEventHandler_JCalls_free(void* this_arg) {
6144 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6145 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6147 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6148 if (get_jenv_res == JNI_EDETACHED) {
6149 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6151 DO_ASSERT(get_jenv_res == JNI_OK);
6153 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6154 if (get_jenv_res == JNI_EDETACHED) {
6155 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6160 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
6161 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6163 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6164 if (get_jenv_res == JNI_EDETACHED) {
6165 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6167 DO_ASSERT(get_jenv_res == JNI_OK);
6169 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6170 *event_copy = event;
6171 uint64_t event_ref = (uint64_t)event_copy;
6172 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6174 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
6175 if ((*env)->ExceptionCheck(env)) {
6176 (*env)->ExceptionDescribe(env);
6177 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6179 if (get_jenv_res == JNI_EDETACHED) {
6180 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6183 static void* LDKEventHandler_JCalls_clone(const void* this_arg) {
6184 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6185 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6186 return (void*) this_arg;
6188 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
6189 jclass c = (*env)->GetObjectClass(env, o);
6191 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6192 atomic_init(&calls->refcnt, 1);
6193 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6194 calls->o = (*env)->NewWeakGlobalRef(env, o);
6195 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
6196 CHECK(calls->handle_event_meth != NULL);
6198 LDKEventHandler ret = {
6199 .this_arg = (void*) calls,
6200 .handle_event = handle_event_LDKEventHandler_jcall,
6201 .free = LDKEventHandler_JCalls_free,
6205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
6206 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6207 *res_ptr = LDKEventHandler_init(env, clz, o);
6208 return (uint64_t)res_ptr;
6210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
6211 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
6212 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
6213 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6216 typedef struct LDKEventsProvider_JCalls {
6217 atomic_size_t refcnt;
6220 jmethodID process_pending_events_meth;
6221 } LDKEventsProvider_JCalls;
6222 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6223 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6224 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6226 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6227 if (get_jenv_res == JNI_EDETACHED) {
6228 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6230 DO_ASSERT(get_jenv_res == JNI_OK);
6232 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6233 if (get_jenv_res == JNI_EDETACHED) {
6234 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6239 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6240 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6242 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6243 if (get_jenv_res == JNI_EDETACHED) {
6244 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6246 DO_ASSERT(get_jenv_res == JNI_OK);
6248 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6250 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6252 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
6253 if ((*env)->ExceptionCheck(env)) {
6254 (*env)->ExceptionDescribe(env);
6255 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6257 if (get_jenv_res == JNI_EDETACHED) {
6258 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6261 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
6262 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6263 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6264 return (void*) this_arg;
6266 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6267 jclass c = (*env)->GetObjectClass(env, o);
6269 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6270 atomic_init(&calls->refcnt, 1);
6271 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6272 calls->o = (*env)->NewWeakGlobalRef(env, o);
6273 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
6274 CHECK(calls->process_pending_events_meth != NULL);
6276 LDKEventsProvider ret = {
6277 .this_arg = (void*) calls,
6278 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6279 .free = LDKEventsProvider_JCalls_free,
6283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6284 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6285 *res_ptr = LDKEventsProvider_init(env, clz, o);
6286 return (uint64_t)res_ptr;
6288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
6289 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
6290 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
6291 if (handler_conv.free == LDKEventHandler_JCalls_free) {
6292 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6293 LDKEventHandler_JCalls_clone(handler_conv.this_arg);
6295 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6298 typedef struct LDKAccess_JCalls {
6299 atomic_size_t refcnt;
6302 jmethodID get_utxo_meth;
6304 static void LDKAccess_JCalls_free(void* this_arg) {
6305 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6306 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6308 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6309 if (get_jenv_res == JNI_EDETACHED) {
6310 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6312 DO_ASSERT(get_jenv_res == JNI_OK);
6314 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6315 if (get_jenv_res == JNI_EDETACHED) {
6316 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6321 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6322 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6324 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6325 if (get_jenv_res == JNI_EDETACHED) {
6326 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6328 DO_ASSERT(get_jenv_res == JNI_OK);
6330 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6331 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6332 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6334 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6335 if ((*env)->ExceptionCheck(env)) {
6336 (*env)->ExceptionDescribe(env);
6337 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6339 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
6340 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6341 if (get_jenv_res == JNI_EDETACHED) {
6342 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6346 static void* LDKAccess_JCalls_clone(const void* this_arg) {
6347 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6348 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6349 return (void*) this_arg;
6351 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6352 jclass c = (*env)->GetObjectClass(env, o);
6354 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6355 atomic_init(&calls->refcnt, 1);
6356 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6357 calls->o = (*env)->NewWeakGlobalRef(env, o);
6358 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6359 CHECK(calls->get_utxo_meth != NULL);
6362 .this_arg = (void*) calls,
6363 .get_utxo = get_utxo_LDKAccess_jcall,
6364 .free = LDKAccess_JCalls_free,
6368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6369 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6370 *res_ptr = LDKAccess_init(env, clz, o);
6371 return (uint64_t)res_ptr;
6373 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) {
6374 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6375 unsigned char genesis_hash_arr[32];
6376 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6377 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6378 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6379 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6380 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6381 return (uint64_t)ret_conv;
6384 typedef struct LDKListen_JCalls {
6385 atomic_size_t refcnt;
6388 jmethodID block_connected_meth;
6389 jmethodID block_disconnected_meth;
6391 static void LDKListen_JCalls_free(void* this_arg) {
6392 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6393 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6395 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6396 if (get_jenv_res == JNI_EDETACHED) {
6397 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6399 DO_ASSERT(get_jenv_res == JNI_OK);
6401 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6402 if (get_jenv_res == JNI_EDETACHED) {
6403 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6408 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6409 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6411 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6412 if (get_jenv_res == JNI_EDETACHED) {
6413 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6415 DO_ASSERT(get_jenv_res == JNI_OK);
6417 LDKu8slice block_var = block;
6418 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
6419 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
6420 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6422 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
6423 if ((*env)->ExceptionCheck(env)) {
6424 (*env)->ExceptionDescribe(env);
6425 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6427 if (get_jenv_res == JNI_EDETACHED) {
6428 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6431 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6432 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6434 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6435 if (get_jenv_res == JNI_EDETACHED) {
6436 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6438 DO_ASSERT(get_jenv_res == JNI_OK);
6440 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6441 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6442 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6444 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
6445 if ((*env)->ExceptionCheck(env)) {
6446 (*env)->ExceptionDescribe(env);
6447 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6449 if (get_jenv_res == JNI_EDETACHED) {
6450 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6453 static void* LDKListen_JCalls_clone(const void* this_arg) {
6454 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6455 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6456 return (void*) this_arg;
6458 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
6459 jclass c = (*env)->GetObjectClass(env, o);
6461 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6462 atomic_init(&calls->refcnt, 1);
6463 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6464 calls->o = (*env)->NewWeakGlobalRef(env, o);
6465 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
6466 CHECK(calls->block_connected_meth != NULL);
6467 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
6468 CHECK(calls->block_disconnected_meth != NULL);
6471 .this_arg = (void*) calls,
6472 .block_connected = block_connected_LDKListen_jcall,
6473 .block_disconnected = block_disconnected_LDKListen_jcall,
6474 .free = LDKListen_JCalls_free,
6478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
6479 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6480 *res_ptr = LDKListen_init(env, clz, o);
6481 return (uint64_t)res_ptr;
6483 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) {
6484 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6485 LDKu8slice block_ref;
6486 block_ref.datalen = (*env)->GetArrayLength(env, block);
6487 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
6488 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6489 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
6492 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) {
6493 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6494 unsigned char header_arr[80];
6495 CHECK((*env)->GetArrayLength(env, header) == 80);
6496 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6497 unsigned char (*header_ref)[80] = &header_arr;
6498 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6501 typedef struct LDKConfirm_JCalls {
6502 atomic_size_t refcnt;
6505 jmethodID transactions_confirmed_meth;
6506 jmethodID transaction_unconfirmed_meth;
6507 jmethodID best_block_updated_meth;
6508 jmethodID get_relevant_txids_meth;
6509 } LDKConfirm_JCalls;
6510 static void LDKConfirm_JCalls_free(void* this_arg) {
6511 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6512 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6514 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6515 if (get_jenv_res == JNI_EDETACHED) {
6516 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6518 DO_ASSERT(get_jenv_res == JNI_OK);
6520 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6521 if (get_jenv_res == JNI_EDETACHED) {
6522 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6527 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6528 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6530 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6531 if (get_jenv_res == JNI_EDETACHED) {
6532 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6534 DO_ASSERT(get_jenv_res == JNI_OK);
6536 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6537 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6538 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6539 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
6540 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
6541 for (size_t y = 0; y < txdata_var.datalen; y++) {
6542 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6543 *txdata_conv_24_ref = txdata_var.data[y];
6544 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
6546 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
6547 FREE(txdata_var.data);
6548 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6550 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
6551 if ((*env)->ExceptionCheck(env)) {
6552 (*env)->ExceptionDescribe(env);
6553 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6555 if (get_jenv_res == JNI_EDETACHED) {
6556 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6559 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6560 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6562 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6563 if (get_jenv_res == JNI_EDETACHED) {
6564 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6566 DO_ASSERT(get_jenv_res == JNI_OK);
6568 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6569 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6570 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6572 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
6573 if ((*env)->ExceptionCheck(env)) {
6574 (*env)->ExceptionDescribe(env);
6575 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6577 if (get_jenv_res == JNI_EDETACHED) {
6578 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6581 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6582 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6584 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6585 if (get_jenv_res == JNI_EDETACHED) {
6586 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6588 DO_ASSERT(get_jenv_res == JNI_OK);
6590 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6591 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6592 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6594 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
6595 if ((*env)->ExceptionCheck(env)) {
6596 (*env)->ExceptionDescribe(env);
6597 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6599 if (get_jenv_res == JNI_EDETACHED) {
6600 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6603 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6604 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6606 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6607 if (get_jenv_res == JNI_EDETACHED) {
6608 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6610 DO_ASSERT(get_jenv_res == JNI_OK);
6612 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6614 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
6615 if ((*env)->ExceptionCheck(env)) {
6616 (*env)->ExceptionDescribe(env);
6617 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6619 LDKCVec_TxidZ ret_constr;
6620 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6621 if (ret_constr.datalen > 0)
6622 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6624 ret_constr.data = NULL;
6625 for (size_t i = 0; i < ret_constr.datalen; i++) {
6626 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
6627 LDKThirtyTwoBytes ret_conv_8_ref;
6628 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
6629 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
6630 ret_constr.data[i] = ret_conv_8_ref;
6632 if (get_jenv_res == JNI_EDETACHED) {
6633 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6637 static void* LDKConfirm_JCalls_clone(const void* this_arg) {
6638 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6639 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6640 return (void*) this_arg;
6642 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
6643 jclass c = (*env)->GetObjectClass(env, o);
6645 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6646 atomic_init(&calls->refcnt, 1);
6647 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6648 calls->o = (*env)->NewWeakGlobalRef(env, o);
6649 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
6650 CHECK(calls->transactions_confirmed_meth != NULL);
6651 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
6652 CHECK(calls->transaction_unconfirmed_meth != NULL);
6653 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
6654 CHECK(calls->best_block_updated_meth != NULL);
6655 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
6656 CHECK(calls->get_relevant_txids_meth != NULL);
6659 .this_arg = (void*) calls,
6660 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6661 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6662 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6663 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6664 .free = LDKConfirm_JCalls_free,
6668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
6669 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6670 *res_ptr = LDKConfirm_init(env, clz, o);
6671 return (uint64_t)res_ptr;
6673 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) {
6674 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6675 unsigned char header_arr[80];
6676 CHECK((*env)->GetArrayLength(env, header) == 80);
6677 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6678 unsigned char (*header_ref)[80] = &header_arr;
6679 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6680 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
6681 if (txdata_constr.datalen > 0)
6682 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6684 txdata_constr.data = NULL;
6685 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
6686 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6687 int64_t txdata_conv_24 = txdata_vals[y];
6688 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
6689 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
6690 txdata_constr.data[y] = txdata_conv_24_conv;
6692 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
6693 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
6697 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6698 unsigned char txid_arr[32];
6699 CHECK((*env)->GetArrayLength(env, txid) == 32);
6700 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6701 unsigned char (*txid_ref)[32] = &txid_arr;
6702 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6705 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) {
6706 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6707 unsigned char header_arr[80];
6708 CHECK((*env)->GetArrayLength(env, header) == 80);
6709 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6710 unsigned char (*header_ref)[80] = &header_arr;
6711 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6714 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
6715 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6716 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6717 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6719 for (size_t i = 0; i < ret_var.datalen; i++) {
6720 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
6721 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
6722 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6728 typedef struct LDKFilter_JCalls {
6729 atomic_size_t refcnt;
6732 jmethodID register_tx_meth;
6733 jmethodID register_output_meth;
6735 static void LDKFilter_JCalls_free(void* this_arg) {
6736 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6737 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6739 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6740 if (get_jenv_res == JNI_EDETACHED) {
6741 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6743 DO_ASSERT(get_jenv_res == JNI_OK);
6745 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6746 if (get_jenv_res == JNI_EDETACHED) {
6747 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6752 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6753 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6755 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6756 if (get_jenv_res == JNI_EDETACHED) {
6757 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6759 DO_ASSERT(get_jenv_res == JNI_OK);
6761 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6762 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6763 LDKu8slice script_pubkey_var = script_pubkey;
6764 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6765 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6766 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6768 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6769 if ((*env)->ExceptionCheck(env)) {
6770 (*env)->ExceptionDescribe(env);
6771 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6773 if (get_jenv_res == JNI_EDETACHED) {
6774 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6777 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6778 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6780 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6781 if (get_jenv_res == JNI_EDETACHED) {
6782 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6784 DO_ASSERT(get_jenv_res == JNI_OK);
6786 LDKWatchedOutput output_var = output;
6787 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6788 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6789 uint64_t output_ref = (uint64_t)output_var.inner;
6790 if (output_var.is_owned) {
6793 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6795 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
6796 if ((*env)->ExceptionCheck(env)) {
6797 (*env)->ExceptionDescribe(env);
6798 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6800 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
6801 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
6802 if (get_jenv_res == JNI_EDETACHED) {
6803 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6807 static void* LDKFilter_JCalls_clone(const void* this_arg) {
6808 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6809 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6810 return (void*) this_arg;
6812 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
6813 jclass c = (*env)->GetObjectClass(env, o);
6815 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
6816 atomic_init(&calls->refcnt, 1);
6817 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6818 calls->o = (*env)->NewWeakGlobalRef(env, o);
6819 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
6820 CHECK(calls->register_tx_meth != NULL);
6821 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
6822 CHECK(calls->register_output_meth != NULL);
6825 .this_arg = (void*) calls,
6826 .register_tx = register_tx_LDKFilter_jcall,
6827 .register_output = register_output_LDKFilter_jcall,
6828 .free = LDKFilter_JCalls_free,
6832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
6833 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
6834 *res_ptr = LDKFilter_init(env, clz, o);
6835 return (uint64_t)res_ptr;
6837 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) {
6838 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6839 unsigned char txid_arr[32];
6840 CHECK((*env)->GetArrayLength(env, txid) == 32);
6841 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6842 unsigned char (*txid_ref)[32] = &txid_arr;
6843 LDKu8slice script_pubkey_ref;
6844 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
6845 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
6846 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
6847 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
6850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
6851 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6852 LDKWatchedOutput output_conv;
6853 output_conv.inner = (void*)(output & (~1));
6854 output_conv.is_owned = (output & 1) || (output == 0);
6855 output_conv = WatchedOutput_clone(&output_conv);
6856 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
6857 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
6858 uint64_t ret_ref = (uint64_t)ret_copy;
6862 typedef struct LDKPersist_JCalls {
6863 atomic_size_t refcnt;
6866 jmethodID persist_new_channel_meth;
6867 jmethodID update_persisted_channel_meth;
6868 } LDKPersist_JCalls;
6869 static void LDKPersist_JCalls_free(void* this_arg) {
6870 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6871 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6873 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6874 if (get_jenv_res == JNI_EDETACHED) {
6875 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6877 DO_ASSERT(get_jenv_res == JNI_OK);
6879 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6880 if (get_jenv_res == JNI_EDETACHED) {
6881 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6886 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
6887 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6889 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6890 if (get_jenv_res == JNI_EDETACHED) {
6891 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6893 DO_ASSERT(get_jenv_res == JNI_OK);
6895 LDKOutPoint id_var = id;
6896 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6897 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6898 uint64_t id_ref = (uint64_t)id_var.inner;
6899 if (id_var.is_owned) {
6902 LDKChannelMonitor data_var = *data;
6903 data_var = ChannelMonitor_clone(data);
6904 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6905 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6906 uint64_t data_ref = (uint64_t)data_var.inner;
6907 if (data_var.is_owned) {
6910 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6912 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
6913 if ((*env)->ExceptionCheck(env)) {
6914 (*env)->ExceptionDescribe(env);
6915 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6917 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6918 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6919 if (get_jenv_res == JNI_EDETACHED) {
6920 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6924 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
6925 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6927 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6928 if (get_jenv_res == JNI_EDETACHED) {
6929 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6931 DO_ASSERT(get_jenv_res == JNI_OK);
6933 LDKOutPoint id_var = id;
6934 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6935 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6936 uint64_t id_ref = (uint64_t)id_var.inner;
6937 if (id_var.is_owned) {
6940 LDKChannelMonitorUpdate update_var = *update;
6941 update_var = ChannelMonitorUpdate_clone(update);
6942 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6943 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6944 uint64_t update_ref = (uint64_t)update_var.inner;
6945 if (update_var.is_owned) {
6948 LDKChannelMonitor data_var = *data;
6949 data_var = ChannelMonitor_clone(data);
6950 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6951 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6952 uint64_t data_ref = (uint64_t)data_var.inner;
6953 if (data_var.is_owned) {
6956 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6958 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
6959 if ((*env)->ExceptionCheck(env)) {
6960 (*env)->ExceptionDescribe(env);
6961 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6963 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6964 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6965 if (get_jenv_res == JNI_EDETACHED) {
6966 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6970 static void* LDKPersist_JCalls_clone(const void* this_arg) {
6971 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6972 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6973 return (void*) this_arg;
6975 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
6976 jclass c = (*env)->GetObjectClass(env, o);
6978 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6979 atomic_init(&calls->refcnt, 1);
6980 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6981 calls->o = (*env)->NewWeakGlobalRef(env, o);
6982 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
6983 CHECK(calls->persist_new_channel_meth != NULL);
6984 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
6985 CHECK(calls->update_persisted_channel_meth != NULL);
6988 .this_arg = (void*) calls,
6989 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6990 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6991 .free = LDKPersist_JCalls_free,
6995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
6996 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6997 *res_ptr = LDKPersist_init(env, clz, o);
6998 return (uint64_t)res_ptr;
7000 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) {
7001 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7002 LDKOutPoint id_conv;
7003 id_conv.inner = (void*)(id & (~1));
7004 id_conv.is_owned = (id & 1) || (id == 0);
7005 id_conv = OutPoint_clone(&id_conv);
7006 LDKChannelMonitor data_conv;
7007 data_conv.inner = (void*)(data & (~1));
7008 data_conv.is_owned = false;
7009 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7010 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
7011 return (uint64_t)ret_conv;
7014 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) {
7015 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7016 LDKOutPoint id_conv;
7017 id_conv.inner = (void*)(id & (~1));
7018 id_conv.is_owned = (id & 1) || (id == 0);
7019 id_conv = OutPoint_clone(&id_conv);
7020 LDKChannelMonitorUpdate update_conv;
7021 update_conv.inner = (void*)(update & (~1));
7022 update_conv.is_owned = false;
7023 LDKChannelMonitor data_conv;
7024 data_conv.inner = (void*)(data & (~1));
7025 data_conv.is_owned = false;
7026 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7027 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
7028 return (uint64_t)ret_conv;
7031 typedef struct LDKChannelMessageHandler_JCalls {
7032 atomic_size_t refcnt;
7035 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7036 jmethodID handle_open_channel_meth;
7037 jmethodID handle_accept_channel_meth;
7038 jmethodID handle_funding_created_meth;
7039 jmethodID handle_funding_signed_meth;
7040 jmethodID handle_funding_locked_meth;
7041 jmethodID handle_shutdown_meth;
7042 jmethodID handle_closing_signed_meth;
7043 jmethodID handle_update_add_htlc_meth;
7044 jmethodID handle_update_fulfill_htlc_meth;
7045 jmethodID handle_update_fail_htlc_meth;
7046 jmethodID handle_update_fail_malformed_htlc_meth;
7047 jmethodID handle_commitment_signed_meth;
7048 jmethodID handle_revoke_and_ack_meth;
7049 jmethodID handle_update_fee_meth;
7050 jmethodID handle_announcement_signatures_meth;
7051 jmethodID peer_disconnected_meth;
7052 jmethodID peer_connected_meth;
7053 jmethodID handle_channel_reestablish_meth;
7054 jmethodID handle_channel_update_meth;
7055 jmethodID handle_error_meth;
7056 } LDKChannelMessageHandler_JCalls;
7057 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
7058 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7059 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7061 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7062 if (get_jenv_res == JNI_EDETACHED) {
7063 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7065 DO_ASSERT(get_jenv_res == JNI_OK);
7067 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7068 if (get_jenv_res == JNI_EDETACHED) {
7069 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7074 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7075 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7077 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7078 if (get_jenv_res == JNI_EDETACHED) {
7079 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7081 DO_ASSERT(get_jenv_res == JNI_OK);
7083 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7084 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7085 LDKInitFeatures their_features_var = their_features;
7086 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7087 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7088 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7089 if (their_features_var.is_owned) {
7090 their_features_ref |= 1;
7092 LDKOpenChannel msg_var = *msg;
7093 msg_var = OpenChannel_clone(msg);
7094 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7095 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7096 uint64_t msg_ref = (uint64_t)msg_var.inner;
7097 if (msg_var.is_owned) {
7100 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7102 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7103 if ((*env)->ExceptionCheck(env)) {
7104 (*env)->ExceptionDescribe(env);
7105 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7107 if (get_jenv_res == JNI_EDETACHED) {
7108 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7111 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7112 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7114 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7115 if (get_jenv_res == JNI_EDETACHED) {
7116 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7118 DO_ASSERT(get_jenv_res == JNI_OK);
7120 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7121 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7122 LDKInitFeatures their_features_var = their_features;
7123 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7124 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7125 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7126 if (their_features_var.is_owned) {
7127 their_features_ref |= 1;
7129 LDKAcceptChannel msg_var = *msg;
7130 msg_var = AcceptChannel_clone(msg);
7131 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7132 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7133 uint64_t msg_ref = (uint64_t)msg_var.inner;
7134 if (msg_var.is_owned) {
7137 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7139 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7140 if ((*env)->ExceptionCheck(env)) {
7141 (*env)->ExceptionDescribe(env);
7142 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7144 if (get_jenv_res == JNI_EDETACHED) {
7145 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7148 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7149 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7151 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7152 if (get_jenv_res == JNI_EDETACHED) {
7153 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7155 DO_ASSERT(get_jenv_res == JNI_OK);
7157 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7158 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7159 LDKFundingCreated msg_var = *msg;
7160 msg_var = FundingCreated_clone(msg);
7161 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7162 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7163 uint64_t msg_ref = (uint64_t)msg_var.inner;
7164 if (msg_var.is_owned) {
7167 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7169 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
7170 if ((*env)->ExceptionCheck(env)) {
7171 (*env)->ExceptionDescribe(env);
7172 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7174 if (get_jenv_res == JNI_EDETACHED) {
7175 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7178 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7179 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7181 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7182 if (get_jenv_res == JNI_EDETACHED) {
7183 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7185 DO_ASSERT(get_jenv_res == JNI_OK);
7187 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7188 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7189 LDKFundingSigned msg_var = *msg;
7190 msg_var = FundingSigned_clone(msg);
7191 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7192 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7193 uint64_t msg_ref = (uint64_t)msg_var.inner;
7194 if (msg_var.is_owned) {
7197 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7199 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
7200 if ((*env)->ExceptionCheck(env)) {
7201 (*env)->ExceptionDescribe(env);
7202 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7204 if (get_jenv_res == JNI_EDETACHED) {
7205 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7208 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7209 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7211 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7212 if (get_jenv_res == JNI_EDETACHED) {
7213 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7215 DO_ASSERT(get_jenv_res == JNI_OK);
7217 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7218 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7219 LDKFundingLocked msg_var = *msg;
7220 msg_var = FundingLocked_clone(msg);
7221 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7222 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7223 uint64_t msg_ref = (uint64_t)msg_var.inner;
7224 if (msg_var.is_owned) {
7227 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7229 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
7230 if ((*env)->ExceptionCheck(env)) {
7231 (*env)->ExceptionDescribe(env);
7232 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7234 if (get_jenv_res == JNI_EDETACHED) {
7235 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7238 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7239 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7241 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7242 if (get_jenv_res == JNI_EDETACHED) {
7243 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7245 DO_ASSERT(get_jenv_res == JNI_OK);
7247 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7248 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7249 LDKInitFeatures their_features_var = *their_features;
7250 their_features_var = InitFeatures_clone(their_features);
7251 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7252 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7253 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7254 if (their_features_var.is_owned) {
7255 their_features_ref |= 1;
7257 LDKShutdown msg_var = *msg;
7258 msg_var = Shutdown_clone(msg);
7259 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7260 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7261 uint64_t msg_ref = (uint64_t)msg_var.inner;
7262 if (msg_var.is_owned) {
7265 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7267 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
7268 if ((*env)->ExceptionCheck(env)) {
7269 (*env)->ExceptionDescribe(env);
7270 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7272 if (get_jenv_res == JNI_EDETACHED) {
7273 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7276 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7277 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7279 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7280 if (get_jenv_res == JNI_EDETACHED) {
7281 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7283 DO_ASSERT(get_jenv_res == JNI_OK);
7285 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7286 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7287 LDKClosingSigned msg_var = *msg;
7288 msg_var = ClosingSigned_clone(msg);
7289 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7290 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7291 uint64_t msg_ref = (uint64_t)msg_var.inner;
7292 if (msg_var.is_owned) {
7295 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7297 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
7298 if ((*env)->ExceptionCheck(env)) {
7299 (*env)->ExceptionDescribe(env);
7300 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7302 if (get_jenv_res == JNI_EDETACHED) {
7303 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7306 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7307 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7309 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7310 if (get_jenv_res == JNI_EDETACHED) {
7311 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7313 DO_ASSERT(get_jenv_res == JNI_OK);
7315 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7316 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7317 LDKUpdateAddHTLC msg_var = *msg;
7318 msg_var = UpdateAddHTLC_clone(msg);
7319 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7320 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7321 uint64_t msg_ref = (uint64_t)msg_var.inner;
7322 if (msg_var.is_owned) {
7325 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7327 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
7328 if ((*env)->ExceptionCheck(env)) {
7329 (*env)->ExceptionDescribe(env);
7330 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7332 if (get_jenv_res == JNI_EDETACHED) {
7333 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7336 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7337 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7339 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7340 if (get_jenv_res == JNI_EDETACHED) {
7341 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7343 DO_ASSERT(get_jenv_res == JNI_OK);
7345 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7346 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7347 LDKUpdateFulfillHTLC msg_var = *msg;
7348 msg_var = UpdateFulfillHTLC_clone(msg);
7349 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7350 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7351 uint64_t msg_ref = (uint64_t)msg_var.inner;
7352 if (msg_var.is_owned) {
7355 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7357 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
7358 if ((*env)->ExceptionCheck(env)) {
7359 (*env)->ExceptionDescribe(env);
7360 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7362 if (get_jenv_res == JNI_EDETACHED) {
7363 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7366 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7367 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7369 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7370 if (get_jenv_res == JNI_EDETACHED) {
7371 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7373 DO_ASSERT(get_jenv_res == JNI_OK);
7375 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7376 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7377 LDKUpdateFailHTLC msg_var = *msg;
7378 msg_var = UpdateFailHTLC_clone(msg);
7379 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7380 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7381 uint64_t msg_ref = (uint64_t)msg_var.inner;
7382 if (msg_var.is_owned) {
7385 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7387 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
7388 if ((*env)->ExceptionCheck(env)) {
7389 (*env)->ExceptionDescribe(env);
7390 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7392 if (get_jenv_res == JNI_EDETACHED) {
7393 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7396 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7397 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7399 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7400 if (get_jenv_res == JNI_EDETACHED) {
7401 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7403 DO_ASSERT(get_jenv_res == JNI_OK);
7405 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7406 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7407 LDKUpdateFailMalformedHTLC msg_var = *msg;
7408 msg_var = UpdateFailMalformedHTLC_clone(msg);
7409 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7410 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7411 uint64_t msg_ref = (uint64_t)msg_var.inner;
7412 if (msg_var.is_owned) {
7415 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7417 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
7418 if ((*env)->ExceptionCheck(env)) {
7419 (*env)->ExceptionDescribe(env);
7420 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7422 if (get_jenv_res == JNI_EDETACHED) {
7423 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7426 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7427 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7429 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7430 if (get_jenv_res == JNI_EDETACHED) {
7431 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7433 DO_ASSERT(get_jenv_res == JNI_OK);
7435 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7436 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7437 LDKCommitmentSigned msg_var = *msg;
7438 msg_var = CommitmentSigned_clone(msg);
7439 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7440 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7441 uint64_t msg_ref = (uint64_t)msg_var.inner;
7442 if (msg_var.is_owned) {
7445 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7447 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
7448 if ((*env)->ExceptionCheck(env)) {
7449 (*env)->ExceptionDescribe(env);
7450 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7452 if (get_jenv_res == JNI_EDETACHED) {
7453 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7456 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7457 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7459 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7460 if (get_jenv_res == JNI_EDETACHED) {
7461 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7463 DO_ASSERT(get_jenv_res == JNI_OK);
7465 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7466 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7467 LDKRevokeAndACK msg_var = *msg;
7468 msg_var = RevokeAndACK_clone(msg);
7469 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7470 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7471 uint64_t msg_ref = (uint64_t)msg_var.inner;
7472 if (msg_var.is_owned) {
7475 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7477 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
7478 if ((*env)->ExceptionCheck(env)) {
7479 (*env)->ExceptionDescribe(env);
7480 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7482 if (get_jenv_res == JNI_EDETACHED) {
7483 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7486 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7487 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7489 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7490 if (get_jenv_res == JNI_EDETACHED) {
7491 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7493 DO_ASSERT(get_jenv_res == JNI_OK);
7495 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7496 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7497 LDKUpdateFee msg_var = *msg;
7498 msg_var = UpdateFee_clone(msg);
7499 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7500 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7501 uint64_t msg_ref = (uint64_t)msg_var.inner;
7502 if (msg_var.is_owned) {
7505 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7507 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
7508 if ((*env)->ExceptionCheck(env)) {
7509 (*env)->ExceptionDescribe(env);
7510 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7512 if (get_jenv_res == JNI_EDETACHED) {
7513 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7516 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7517 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7519 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7520 if (get_jenv_res == JNI_EDETACHED) {
7521 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7523 DO_ASSERT(get_jenv_res == JNI_OK);
7525 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7526 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7527 LDKAnnouncementSignatures msg_var = *msg;
7528 msg_var = AnnouncementSignatures_clone(msg);
7529 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7530 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7531 uint64_t msg_ref = (uint64_t)msg_var.inner;
7532 if (msg_var.is_owned) {
7535 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7537 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
7538 if ((*env)->ExceptionCheck(env)) {
7539 (*env)->ExceptionDescribe(env);
7540 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7542 if (get_jenv_res == JNI_EDETACHED) {
7543 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7546 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7547 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7549 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7550 if (get_jenv_res == JNI_EDETACHED) {
7551 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7553 DO_ASSERT(get_jenv_res == JNI_OK);
7555 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7556 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7557 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7559 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
7560 if ((*env)->ExceptionCheck(env)) {
7561 (*env)->ExceptionDescribe(env);
7562 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7564 if (get_jenv_res == JNI_EDETACHED) {
7565 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7568 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7569 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7571 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7572 if (get_jenv_res == JNI_EDETACHED) {
7573 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7575 DO_ASSERT(get_jenv_res == JNI_OK);
7577 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7578 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7579 LDKInit msg_var = *msg;
7580 msg_var = Init_clone(msg);
7581 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7582 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7583 uint64_t msg_ref = (uint64_t)msg_var.inner;
7584 if (msg_var.is_owned) {
7587 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7589 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
7590 if ((*env)->ExceptionCheck(env)) {
7591 (*env)->ExceptionDescribe(env);
7592 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7594 if (get_jenv_res == JNI_EDETACHED) {
7595 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7598 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7599 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7601 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7602 if (get_jenv_res == JNI_EDETACHED) {
7603 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7605 DO_ASSERT(get_jenv_res == JNI_OK);
7607 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7608 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7609 LDKChannelReestablish msg_var = *msg;
7610 msg_var = ChannelReestablish_clone(msg);
7611 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7612 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7613 uint64_t msg_ref = (uint64_t)msg_var.inner;
7614 if (msg_var.is_owned) {
7617 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7619 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
7620 if ((*env)->ExceptionCheck(env)) {
7621 (*env)->ExceptionDescribe(env);
7622 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7624 if (get_jenv_res == JNI_EDETACHED) {
7625 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7628 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7629 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7631 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7632 if (get_jenv_res == JNI_EDETACHED) {
7633 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7635 DO_ASSERT(get_jenv_res == JNI_OK);
7637 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7638 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7639 LDKChannelUpdate msg_var = *msg;
7640 msg_var = ChannelUpdate_clone(msg);
7641 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7642 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7643 uint64_t msg_ref = (uint64_t)msg_var.inner;
7644 if (msg_var.is_owned) {
7647 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7649 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
7650 if ((*env)->ExceptionCheck(env)) {
7651 (*env)->ExceptionDescribe(env);
7652 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7654 if (get_jenv_res == JNI_EDETACHED) {
7655 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7658 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7659 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7661 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7662 if (get_jenv_res == JNI_EDETACHED) {
7663 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7665 DO_ASSERT(get_jenv_res == JNI_OK);
7667 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7668 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7669 LDKErrorMessage msg_var = *msg;
7670 msg_var = ErrorMessage_clone(msg);
7671 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7672 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7673 uint64_t msg_ref = (uint64_t)msg_var.inner;
7674 if (msg_var.is_owned) {
7677 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7679 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
7680 if ((*env)->ExceptionCheck(env)) {
7681 (*env)->ExceptionDescribe(env);
7682 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7684 if (get_jenv_res == JNI_EDETACHED) {
7685 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7688 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
7689 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7690 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7691 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7692 return (void*) this_arg;
7694 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7695 jclass c = (*env)->GetObjectClass(env, o);
7697 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7698 atomic_init(&calls->refcnt, 1);
7699 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7700 calls->o = (*env)->NewWeakGlobalRef(env, o);
7701 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
7702 CHECK(calls->handle_open_channel_meth != NULL);
7703 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
7704 CHECK(calls->handle_accept_channel_meth != NULL);
7705 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
7706 CHECK(calls->handle_funding_created_meth != NULL);
7707 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
7708 CHECK(calls->handle_funding_signed_meth != NULL);
7709 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
7710 CHECK(calls->handle_funding_locked_meth != NULL);
7711 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
7712 CHECK(calls->handle_shutdown_meth != NULL);
7713 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
7714 CHECK(calls->handle_closing_signed_meth != NULL);
7715 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
7716 CHECK(calls->handle_update_add_htlc_meth != NULL);
7717 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
7718 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
7719 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
7720 CHECK(calls->handle_update_fail_htlc_meth != NULL);
7721 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
7722 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
7723 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
7724 CHECK(calls->handle_commitment_signed_meth != NULL);
7725 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
7726 CHECK(calls->handle_revoke_and_ack_meth != NULL);
7727 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
7728 CHECK(calls->handle_update_fee_meth != NULL);
7729 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
7730 CHECK(calls->handle_announcement_signatures_meth != NULL);
7731 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
7732 CHECK(calls->peer_disconnected_meth != NULL);
7733 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
7734 CHECK(calls->peer_connected_meth != NULL);
7735 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
7736 CHECK(calls->handle_channel_reestablish_meth != NULL);
7737 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
7738 CHECK(calls->handle_channel_update_meth != NULL);
7739 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
7740 CHECK(calls->handle_error_meth != NULL);
7742 LDKChannelMessageHandler ret = {
7743 .this_arg = (void*) calls,
7744 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7745 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7746 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7747 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7748 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7749 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7750 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7751 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7752 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7753 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7754 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7755 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7756 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7757 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7758 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7759 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7760 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7761 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7762 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7763 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7764 .free = LDKChannelMessageHandler_JCalls_free,
7765 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
7767 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7771 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7772 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
7773 return (uint64_t)res_ptr;
7775 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) {
7776 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7777 LDKPublicKey their_node_id_ref;
7778 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7779 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7780 LDKInitFeatures their_features_conv;
7781 their_features_conv.inner = (void*)(their_features & (~1));
7782 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7783 their_features_conv = InitFeatures_clone(&their_features_conv);
7784 LDKOpenChannel msg_conv;
7785 msg_conv.inner = (void*)(msg & (~1));
7786 msg_conv.is_owned = false;
7787 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7790 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) {
7791 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7792 LDKPublicKey their_node_id_ref;
7793 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7794 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7795 LDKInitFeatures their_features_conv;
7796 their_features_conv.inner = (void*)(their_features & (~1));
7797 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7798 their_features_conv = InitFeatures_clone(&their_features_conv);
7799 LDKAcceptChannel msg_conv;
7800 msg_conv.inner = (void*)(msg & (~1));
7801 msg_conv.is_owned = false;
7802 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7805 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) {
7806 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7807 LDKPublicKey their_node_id_ref;
7808 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7809 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7810 LDKFundingCreated msg_conv;
7811 msg_conv.inner = (void*)(msg & (~1));
7812 msg_conv.is_owned = false;
7813 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7816 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) {
7817 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7818 LDKPublicKey their_node_id_ref;
7819 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7820 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7821 LDKFundingSigned msg_conv;
7822 msg_conv.inner = (void*)(msg & (~1));
7823 msg_conv.is_owned = false;
7824 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7827 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) {
7828 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7829 LDKPublicKey their_node_id_ref;
7830 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7831 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7832 LDKFundingLocked msg_conv;
7833 msg_conv.inner = (void*)(msg & (~1));
7834 msg_conv.is_owned = false;
7835 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7838 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) {
7839 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7840 LDKPublicKey their_node_id_ref;
7841 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7842 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7843 LDKInitFeatures their_features_conv;
7844 their_features_conv.inner = (void*)(their_features & (~1));
7845 their_features_conv.is_owned = false;
7846 LDKShutdown msg_conv;
7847 msg_conv.inner = (void*)(msg & (~1));
7848 msg_conv.is_owned = false;
7849 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7852 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) {
7853 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7854 LDKPublicKey their_node_id_ref;
7855 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7856 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7857 LDKClosingSigned msg_conv;
7858 msg_conv.inner = (void*)(msg & (~1));
7859 msg_conv.is_owned = false;
7860 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7863 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) {
7864 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7865 LDKPublicKey their_node_id_ref;
7866 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7867 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7868 LDKUpdateAddHTLC msg_conv;
7869 msg_conv.inner = (void*)(msg & (~1));
7870 msg_conv.is_owned = false;
7871 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7874 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) {
7875 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7876 LDKPublicKey their_node_id_ref;
7877 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7878 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7879 LDKUpdateFulfillHTLC msg_conv;
7880 msg_conv.inner = (void*)(msg & (~1));
7881 msg_conv.is_owned = false;
7882 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7885 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) {
7886 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7887 LDKPublicKey their_node_id_ref;
7888 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7889 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7890 LDKUpdateFailHTLC msg_conv;
7891 msg_conv.inner = (void*)(msg & (~1));
7892 msg_conv.is_owned = false;
7893 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7896 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) {
7897 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7898 LDKPublicKey their_node_id_ref;
7899 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7900 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7901 LDKUpdateFailMalformedHTLC msg_conv;
7902 msg_conv.inner = (void*)(msg & (~1));
7903 msg_conv.is_owned = false;
7904 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7907 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) {
7908 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7909 LDKPublicKey their_node_id_ref;
7910 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7911 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7912 LDKCommitmentSigned msg_conv;
7913 msg_conv.inner = (void*)(msg & (~1));
7914 msg_conv.is_owned = false;
7915 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7918 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) {
7919 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7920 LDKPublicKey their_node_id_ref;
7921 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7922 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7923 LDKRevokeAndACK msg_conv;
7924 msg_conv.inner = (void*)(msg & (~1));
7925 msg_conv.is_owned = false;
7926 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7929 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) {
7930 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7931 LDKPublicKey their_node_id_ref;
7932 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7933 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7934 LDKUpdateFee msg_conv;
7935 msg_conv.inner = (void*)(msg & (~1));
7936 msg_conv.is_owned = false;
7937 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7940 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) {
7941 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7942 LDKPublicKey their_node_id_ref;
7943 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7944 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7945 LDKAnnouncementSignatures msg_conv;
7946 msg_conv.inner = (void*)(msg & (~1));
7947 msg_conv.is_owned = false;
7948 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7951 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) {
7952 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7953 LDKPublicKey their_node_id_ref;
7954 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7955 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7956 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7959 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) {
7960 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7961 LDKPublicKey their_node_id_ref;
7962 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7963 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7965 msg_conv.inner = (void*)(msg & (~1));
7966 msg_conv.is_owned = false;
7967 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7970 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) {
7971 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7972 LDKPublicKey their_node_id_ref;
7973 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7974 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7975 LDKChannelReestablish msg_conv;
7976 msg_conv.inner = (void*)(msg & (~1));
7977 msg_conv.is_owned = false;
7978 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7981 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) {
7982 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7983 LDKPublicKey their_node_id_ref;
7984 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7985 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7986 LDKChannelUpdate msg_conv;
7987 msg_conv.inner = (void*)(msg & (~1));
7988 msg_conv.is_owned = false;
7989 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7992 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) {
7993 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7994 LDKPublicKey their_node_id_ref;
7995 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7996 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7997 LDKErrorMessage msg_conv;
7998 msg_conv.inner = (void*)(msg & (~1));
7999 msg_conv.is_owned = false;
8000 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8003 typedef struct LDKRoutingMessageHandler_JCalls {
8004 atomic_size_t refcnt;
8007 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8008 jmethodID handle_node_announcement_meth;
8009 jmethodID handle_channel_announcement_meth;
8010 jmethodID handle_channel_update_meth;
8011 jmethodID handle_htlc_fail_channel_update_meth;
8012 jmethodID get_next_channel_announcements_meth;
8013 jmethodID get_next_node_announcements_meth;
8014 jmethodID sync_routing_table_meth;
8015 jmethodID handle_reply_channel_range_meth;
8016 jmethodID handle_reply_short_channel_ids_end_meth;
8017 jmethodID handle_query_channel_range_meth;
8018 jmethodID handle_query_short_channel_ids_meth;
8019 } LDKRoutingMessageHandler_JCalls;
8020 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
8021 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8022 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8024 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8025 if (get_jenv_res == JNI_EDETACHED) {
8026 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8028 DO_ASSERT(get_jenv_res == JNI_OK);
8030 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8031 if (get_jenv_res == JNI_EDETACHED) {
8032 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8037 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
8038 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8040 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8041 if (get_jenv_res == JNI_EDETACHED) {
8042 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8044 DO_ASSERT(get_jenv_res == JNI_OK);
8046 LDKNodeAnnouncement msg_var = *msg;
8047 msg_var = NodeAnnouncement_clone(msg);
8048 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8049 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8050 uint64_t msg_ref = (uint64_t)msg_var.inner;
8051 if (msg_var.is_owned) {
8054 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8056 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
8057 if ((*env)->ExceptionCheck(env)) {
8058 (*env)->ExceptionDescribe(env);
8059 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8061 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8062 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8063 if (get_jenv_res == JNI_EDETACHED) {
8064 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8068 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
8069 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8071 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8072 if (get_jenv_res == JNI_EDETACHED) {
8073 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8075 DO_ASSERT(get_jenv_res == JNI_OK);
8077 LDKChannelAnnouncement msg_var = *msg;
8078 msg_var = ChannelAnnouncement_clone(msg);
8079 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8080 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8081 uint64_t msg_ref = (uint64_t)msg_var.inner;
8082 if (msg_var.is_owned) {
8085 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8087 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
8088 if ((*env)->ExceptionCheck(env)) {
8089 (*env)->ExceptionDescribe(env);
8090 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8092 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8093 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8094 if (get_jenv_res == JNI_EDETACHED) {
8095 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8099 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
8100 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8102 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8103 if (get_jenv_res == JNI_EDETACHED) {
8104 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8106 DO_ASSERT(get_jenv_res == JNI_OK);
8108 LDKChannelUpdate msg_var = *msg;
8109 msg_var = ChannelUpdate_clone(msg);
8110 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8111 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8112 uint64_t msg_ref = (uint64_t)msg_var.inner;
8113 if (msg_var.is_owned) {
8116 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8118 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
8119 if ((*env)->ExceptionCheck(env)) {
8120 (*env)->ExceptionDescribe(env);
8121 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8123 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8124 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8125 if (get_jenv_res == JNI_EDETACHED) {
8126 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8130 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
8131 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8133 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8134 if (get_jenv_res == JNI_EDETACHED) {
8135 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8137 DO_ASSERT(get_jenv_res == JNI_OK);
8139 uint64_t ret_update = (uint64_t)update;
8140 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8142 (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
8143 if ((*env)->ExceptionCheck(env)) {
8144 (*env)->ExceptionDescribe(env);
8145 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8147 if (get_jenv_res == JNI_EDETACHED) {
8148 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8151 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
8152 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8154 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8155 if (get_jenv_res == JNI_EDETACHED) {
8156 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8158 DO_ASSERT(get_jenv_res == JNI_OK);
8160 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8162 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
8163 if ((*env)->ExceptionCheck(env)) {
8164 (*env)->ExceptionDescribe(env);
8165 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8167 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
8168 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8169 if (ret_constr.datalen > 0)
8170 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
8172 ret_constr.data = NULL;
8173 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8174 for (size_t l = 0; l < ret_constr.datalen; l++) {
8175 int64_t ret_conv_63 = ret_vals[l];
8176 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
8177 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
8178 ret_constr.data[l] = ret_conv_63_conv;
8180 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8181 if (get_jenv_res == JNI_EDETACHED) {
8182 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8186 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
8187 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8189 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8190 if (get_jenv_res == JNI_EDETACHED) {
8191 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8193 DO_ASSERT(get_jenv_res == JNI_OK);
8195 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
8196 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
8197 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8199 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
8200 if ((*env)->ExceptionCheck(env)) {
8201 (*env)->ExceptionDescribe(env);
8202 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8204 LDKCVec_NodeAnnouncementZ ret_constr;
8205 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8206 if (ret_constr.datalen > 0)
8207 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
8209 ret_constr.data = NULL;
8210 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8211 for (size_t s = 0; s < ret_constr.datalen; s++) {
8212 int64_t ret_conv_18 = ret_vals[s];
8213 LDKNodeAnnouncement ret_conv_18_conv;
8214 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
8215 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
8216 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
8217 ret_constr.data[s] = ret_conv_18_conv;
8219 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8220 if (get_jenv_res == JNI_EDETACHED) {
8221 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8225 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
8226 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8228 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8229 if (get_jenv_res == JNI_EDETACHED) {
8230 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8232 DO_ASSERT(get_jenv_res == JNI_OK);
8234 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8235 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8236 LDKInit init_var = *init;
8237 init_var = Init_clone(init);
8238 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8239 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8240 uint64_t init_ref = (uint64_t)init_var.inner;
8241 if (init_var.is_owned) {
8244 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8246 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
8247 if ((*env)->ExceptionCheck(env)) {
8248 (*env)->ExceptionDescribe(env);
8249 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8251 if (get_jenv_res == JNI_EDETACHED) {
8252 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8255 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
8256 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8258 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8259 if (get_jenv_res == JNI_EDETACHED) {
8260 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8262 DO_ASSERT(get_jenv_res == JNI_OK);
8264 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8265 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8266 LDKReplyChannelRange msg_var = msg;
8267 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8268 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8269 uint64_t msg_ref = (uint64_t)msg_var.inner;
8270 if (msg_var.is_owned) {
8273 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8275 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
8276 if ((*env)->ExceptionCheck(env)) {
8277 (*env)->ExceptionDescribe(env);
8278 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8280 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8281 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8282 if (get_jenv_res == JNI_EDETACHED) {
8283 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8287 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8288 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8290 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8291 if (get_jenv_res == JNI_EDETACHED) {
8292 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8294 DO_ASSERT(get_jenv_res == JNI_OK);
8296 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8297 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8298 LDKReplyShortChannelIdsEnd msg_var = msg;
8299 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8300 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8301 uint64_t msg_ref = (uint64_t)msg_var.inner;
8302 if (msg_var.is_owned) {
8305 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8307 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
8308 if ((*env)->ExceptionCheck(env)) {
8309 (*env)->ExceptionDescribe(env);
8310 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8312 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8313 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8314 if (get_jenv_res == JNI_EDETACHED) {
8315 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8319 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8320 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8322 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8323 if (get_jenv_res == JNI_EDETACHED) {
8324 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8326 DO_ASSERT(get_jenv_res == JNI_OK);
8328 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8329 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8330 LDKQueryChannelRange msg_var = msg;
8331 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8332 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8333 uint64_t msg_ref = (uint64_t)msg_var.inner;
8334 if (msg_var.is_owned) {
8337 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8339 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
8340 if ((*env)->ExceptionCheck(env)) {
8341 (*env)->ExceptionDescribe(env);
8342 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8344 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8345 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8346 if (get_jenv_res == JNI_EDETACHED) {
8347 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8351 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8352 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8354 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8355 if (get_jenv_res == JNI_EDETACHED) {
8356 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8358 DO_ASSERT(get_jenv_res == JNI_OK);
8360 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8361 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8362 LDKQueryShortChannelIds msg_var = msg;
8363 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8364 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8365 uint64_t msg_ref = (uint64_t)msg_var.inner;
8366 if (msg_var.is_owned) {
8369 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8371 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
8372 if ((*env)->ExceptionCheck(env)) {
8373 (*env)->ExceptionDescribe(env);
8374 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8376 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8377 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8378 if (get_jenv_res == JNI_EDETACHED) {
8379 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8383 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
8384 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8385 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8386 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8387 return (void*) this_arg;
8389 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8390 jclass c = (*env)->GetObjectClass(env, o);
8392 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8393 atomic_init(&calls->refcnt, 1);
8394 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8395 calls->o = (*env)->NewWeakGlobalRef(env, o);
8396 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
8397 CHECK(calls->handle_node_announcement_meth != NULL);
8398 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
8399 CHECK(calls->handle_channel_announcement_meth != NULL);
8400 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
8401 CHECK(calls->handle_channel_update_meth != NULL);
8402 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
8403 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
8404 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
8405 CHECK(calls->get_next_channel_announcements_meth != NULL);
8406 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
8407 CHECK(calls->get_next_node_announcements_meth != NULL);
8408 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
8409 CHECK(calls->sync_routing_table_meth != NULL);
8410 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
8411 CHECK(calls->handle_reply_channel_range_meth != NULL);
8412 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
8413 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
8414 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
8415 CHECK(calls->handle_query_channel_range_meth != NULL);
8416 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
8417 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
8419 LDKRoutingMessageHandler ret = {
8420 .this_arg = (void*) calls,
8421 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8422 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8423 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8424 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
8425 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8426 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8427 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8428 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8429 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8430 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8431 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8432 .free = LDKRoutingMessageHandler_JCalls_free,
8433 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8435 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8439 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8440 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8441 return (uint64_t)res_ptr;
8443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8444 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8445 LDKNodeAnnouncement msg_conv;
8446 msg_conv.inner = (void*)(msg & (~1));
8447 msg_conv.is_owned = false;
8448 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8449 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8450 return (uint64_t)ret_conv;
8453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8454 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8455 LDKChannelAnnouncement msg_conv;
8456 msg_conv.inner = (void*)(msg & (~1));
8457 msg_conv.is_owned = false;
8458 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8459 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8460 return (uint64_t)ret_conv;
8463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8464 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8465 LDKChannelUpdate msg_conv;
8466 msg_conv.inner = (void*)(msg & (~1));
8467 msg_conv.is_owned = false;
8468 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8469 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8470 return (uint64_t)ret_conv;
8473 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) {
8474 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8475 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
8476 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
8479 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) {
8480 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8481 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8482 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8483 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8484 for (size_t l = 0; l < ret_var.datalen; l++) {
8485 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8486 *ret_conv_63_ref = ret_var.data[l];
8487 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
8489 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8494 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) {
8495 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8496 LDKPublicKey starting_point_ref;
8497 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
8498 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
8499 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8500 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8501 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8502 for (size_t s = 0; s < ret_var.datalen; s++) {
8503 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8504 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8505 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8506 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8507 if (ret_conv_18_var.is_owned) {
8508 ret_conv_18_ref |= 1;
8510 ret_arr_ptr[s] = ret_conv_18_ref;
8512 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8517 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) {
8518 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8519 LDKPublicKey their_node_id_ref;
8520 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8521 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8523 init_conv.inner = (void*)(init & (~1));
8524 init_conv.is_owned = false;
8525 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8528 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) {
8529 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8530 LDKPublicKey their_node_id_ref;
8531 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8532 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8533 LDKReplyChannelRange msg_conv;
8534 msg_conv.inner = (void*)(msg & (~1));
8535 msg_conv.is_owned = (msg & 1) || (msg == 0);
8536 msg_conv = ReplyChannelRange_clone(&msg_conv);
8537 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8538 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8539 return (uint64_t)ret_conv;
8542 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) {
8543 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8544 LDKPublicKey their_node_id_ref;
8545 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8546 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8547 LDKReplyShortChannelIdsEnd msg_conv;
8548 msg_conv.inner = (void*)(msg & (~1));
8549 msg_conv.is_owned = (msg & 1) || (msg == 0);
8550 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8551 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8552 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8553 return (uint64_t)ret_conv;
8556 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) {
8557 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8558 LDKPublicKey their_node_id_ref;
8559 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8560 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8561 LDKQueryChannelRange msg_conv;
8562 msg_conv.inner = (void*)(msg & (~1));
8563 msg_conv.is_owned = (msg & 1) || (msg == 0);
8564 msg_conv = QueryChannelRange_clone(&msg_conv);
8565 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8566 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8567 return (uint64_t)ret_conv;
8570 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) {
8571 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8572 LDKPublicKey their_node_id_ref;
8573 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8574 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8575 LDKQueryShortChannelIds msg_conv;
8576 msg_conv.inner = (void*)(msg & (~1));
8577 msg_conv.is_owned = (msg & 1) || (msg == 0);
8578 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8579 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8580 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8581 return (uint64_t)ret_conv;
8584 typedef struct LDKSocketDescriptor_JCalls {
8585 atomic_size_t refcnt;
8588 jmethodID send_data_meth;
8589 jmethodID disconnect_socket_meth;
8591 jmethodID hash_meth;
8592 } LDKSocketDescriptor_JCalls;
8593 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8594 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8595 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8597 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8598 if (get_jenv_res == JNI_EDETACHED) {
8599 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8601 DO_ASSERT(get_jenv_res == JNI_OK);
8603 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8604 if (get_jenv_res == JNI_EDETACHED) {
8605 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8610 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8611 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8613 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8614 if (get_jenv_res == JNI_EDETACHED) {
8615 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8617 DO_ASSERT(get_jenv_res == JNI_OK);
8619 LDKu8slice data_var = data;
8620 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
8621 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
8622 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8624 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
8625 if ((*env)->ExceptionCheck(env)) {
8626 (*env)->ExceptionDescribe(env);
8627 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8629 if (get_jenv_res == JNI_EDETACHED) {
8630 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8634 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8635 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8637 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8638 if (get_jenv_res == JNI_EDETACHED) {
8639 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8641 DO_ASSERT(get_jenv_res == JNI_OK);
8643 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8645 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
8646 if ((*env)->ExceptionCheck(env)) {
8647 (*env)->ExceptionDescribe(env);
8648 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8650 if (get_jenv_res == JNI_EDETACHED) {
8651 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8654 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8655 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8657 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8658 if (get_jenv_res == JNI_EDETACHED) {
8659 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8661 DO_ASSERT(get_jenv_res == JNI_OK);
8663 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8664 *other_arg_clone = SocketDescriptor_clone(other_arg);
8665 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8667 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
8668 if ((*env)->ExceptionCheck(env)) {
8669 (*env)->ExceptionDescribe(env);
8670 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8672 if (get_jenv_res == JNI_EDETACHED) {
8673 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8677 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8678 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8680 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8681 if (get_jenv_res == JNI_EDETACHED) {
8682 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8684 DO_ASSERT(get_jenv_res == JNI_OK);
8686 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8688 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
8689 if ((*env)->ExceptionCheck(env)) {
8690 (*env)->ExceptionDescribe(env);
8691 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8693 if (get_jenv_res == JNI_EDETACHED) {
8694 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8698 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
8699 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8700 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8701 return (void*) this_arg;
8703 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
8704 jclass c = (*env)->GetObjectClass(env, o);
8706 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8707 atomic_init(&calls->refcnt, 1);
8708 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8709 calls->o = (*env)->NewWeakGlobalRef(env, o);
8710 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
8711 CHECK(calls->send_data_meth != NULL);
8712 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
8713 CHECK(calls->disconnect_socket_meth != NULL);
8714 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
8715 CHECK(calls->eq_meth != NULL);
8716 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
8717 CHECK(calls->hash_meth != NULL);
8719 LDKSocketDescriptor ret = {
8720 .this_arg = (void*) calls,
8721 .send_data = send_data_LDKSocketDescriptor_jcall,
8722 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8723 .eq = eq_LDKSocketDescriptor_jcall,
8724 .hash = hash_LDKSocketDescriptor_jcall,
8725 .clone = LDKSocketDescriptor_JCalls_clone,
8726 .free = LDKSocketDescriptor_JCalls_free,
8730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
8731 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8732 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
8733 return (uint64_t)res_ptr;
8735 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) {
8736 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8737 LDKu8slice data_ref;
8738 data_ref.datalen = (*env)->GetArrayLength(env, data);
8739 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
8740 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8741 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
8745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
8746 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8747 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
8751 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8752 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8756 typedef struct LDKChannelManagerPersister_JCalls {
8757 atomic_size_t refcnt;
8760 jmethodID persist_manager_meth;
8761 } LDKChannelManagerPersister_JCalls;
8762 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
8763 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8764 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8766 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8767 if (get_jenv_res == JNI_EDETACHED) {
8768 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8770 DO_ASSERT(get_jenv_res == JNI_OK);
8772 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8773 if (get_jenv_res == JNI_EDETACHED) {
8774 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8779 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8780 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8782 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8783 if (get_jenv_res == JNI_EDETACHED) {
8784 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8786 DO_ASSERT(get_jenv_res == JNI_OK);
8788 LDKChannelManager channel_manager_var = *channel_manager;
8789 // Warning: we may need a move here but no clone is available for LDKChannelManager
8790 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8791 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8792 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
8793 if (channel_manager_var.is_owned) {
8794 channel_manager_ref |= 1;
8796 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8798 LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
8799 if ((*env)->ExceptionCheck(env)) {
8800 (*env)->ExceptionDescribe(env);
8801 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8803 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
8804 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
8805 if (get_jenv_res == JNI_EDETACHED) {
8806 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8810 static void* LDKChannelManagerPersister_JCalls_clone(const void* this_arg) {
8811 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8812 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8813 return (void*) this_arg;
8815 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
8816 jclass c = (*env)->GetObjectClass(env, o);
8818 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
8819 atomic_init(&calls->refcnt, 1);
8820 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8821 calls->o = (*env)->NewWeakGlobalRef(env, o);
8822 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
8823 CHECK(calls->persist_manager_meth != NULL);
8825 LDKChannelManagerPersister ret = {
8826 .this_arg = (void*) calls,
8827 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
8828 .free = LDKChannelManagerPersister_JCalls_free,
8832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
8833 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
8834 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
8835 return (uint64_t)res_ptr;
8837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
8838 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
8839 LDKChannelManager channel_manager_conv;
8840 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8841 channel_manager_conv.is_owned = false;
8842 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8843 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8844 return (uint64_t)ret_conv;
8847 static jclass LDKFallback_SegWitProgram_class = NULL;
8848 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
8849 static jclass LDKFallback_PubKeyHash_class = NULL;
8850 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
8851 static jclass LDKFallback_ScriptHash_class = NULL;
8852 static jmethodID LDKFallback_ScriptHash_meth = NULL;
8853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
8854 LDKFallback_SegWitProgram_class =
8855 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
8856 CHECK(LDKFallback_SegWitProgram_class != NULL);
8857 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
8858 CHECK(LDKFallback_SegWitProgram_meth != NULL);
8859 LDKFallback_PubKeyHash_class =
8860 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
8861 CHECK(LDKFallback_PubKeyHash_class != NULL);
8862 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
8863 CHECK(LDKFallback_PubKeyHash_meth != NULL);
8864 LDKFallback_ScriptHash_class =
8865 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
8866 CHECK(LDKFallback_ScriptHash_class != NULL);
8867 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
8868 CHECK(LDKFallback_ScriptHash_meth != NULL);
8870 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8871 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
8873 case LDKFallback_SegWitProgram: {
8874 uint8_t version_val = obj->seg_wit_program.version._0;
8875 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
8876 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
8877 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
8878 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
8880 case LDKFallback_PubKeyHash: {
8881 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
8882 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
8883 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
8885 case LDKFallback_ScriptHash: {
8886 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
8887 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
8888 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
8893 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8894 LDKStr ret_str = _ldk_get_compiled_version();
8895 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8899 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8900 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8901 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
8906 LDKTransaction _res_ref;
8907 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
8908 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8909 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
8910 _res_ref.data_is_owned = true;
8911 Transaction_free(_res_ref);
8914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
8915 if ((_res & 1) != 0) return;
8916 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
8918 TxOut_free(_res_conv);
8921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8922 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8923 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8924 *ret_ref = TxOut_clone(orig_conv);
8925 return (uint64_t)ret_ref;
8928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
8929 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8935 CHECK((*env)->GetArrayLength(env, o) == 32);
8936 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
8937 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8938 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
8939 return (uint64_t)ret_conv;
8942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8943 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8944 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8945 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
8946 return (uint64_t)ret_conv;
8949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8950 if ((_res & 1) != 0) return;
8951 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
8953 CResult_SecretKeyErrorZ_free(_res_conv);
8956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8958 CHECK((*env)->GetArrayLength(env, o) == 33);
8959 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
8960 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8961 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
8962 return (uint64_t)ret_conv;
8965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8966 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8967 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8968 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
8969 return (uint64_t)ret_conv;
8972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8973 if ((_res & 1) != 0) return;
8974 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
8976 CResult_PublicKeyErrorZ_free(_res_conv);
8979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8980 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8981 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8982 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8983 return (uint64_t)ret_conv;
8986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8987 LDKTxCreationKeys o_conv;
8988 o_conv.inner = (void*)(o & (~1));
8989 o_conv.is_owned = (o & 1) || (o == 0);
8990 o_conv = TxCreationKeys_clone(&o_conv);
8991 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8992 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8993 return (uint64_t)ret_conv;
8996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8997 LDKDecodeError e_conv;
8998 e_conv.inner = (void*)(e & (~1));
8999 e_conv.is_owned = (e & 1) || (e == 0);
9000 e_conv = DecodeError_clone(&e_conv);
9001 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9002 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
9003 return (uint64_t)ret_conv;
9006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9007 if ((_res & 1) != 0) return;
9008 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
9010 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
9013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9014 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
9015 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9016 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
9017 return (uint64_t)ret_conv;
9020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9021 LDKChannelPublicKeys o_conv;
9022 o_conv.inner = (void*)(o & (~1));
9023 o_conv.is_owned = (o & 1) || (o == 0);
9024 o_conv = ChannelPublicKeys_clone(&o_conv);
9025 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9026 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
9027 return (uint64_t)ret_conv;
9030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9031 LDKDecodeError e_conv;
9032 e_conv.inner = (void*)(e & (~1));
9033 e_conv.is_owned = (e & 1) || (e == 0);
9034 e_conv = DecodeError_clone(&e_conv);
9035 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9036 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
9037 return (uint64_t)ret_conv;
9040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9041 if ((_res & 1) != 0) return;
9042 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
9044 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
9047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9048 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
9049 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9050 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
9051 return (uint64_t)ret_conv;
9054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9055 LDKTxCreationKeys o_conv;
9056 o_conv.inner = (void*)(o & (~1));
9057 o_conv.is_owned = (o & 1) || (o == 0);
9058 o_conv = TxCreationKeys_clone(&o_conv);
9059 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9060 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
9061 return (uint64_t)ret_conv;
9064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9065 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9066 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9067 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
9068 return (uint64_t)ret_conv;
9071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9072 if ((_res & 1) != 0) return;
9073 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
9075 CResult_TxCreationKeysErrorZ_free(_res_conv);
9078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9079 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
9080 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9081 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
9082 return (uint64_t)ret_conv;
9085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
9086 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9087 *ret_copy = COption_u32Z_some(o);
9088 uint64_t ret_ref = (uint64_t)ret_copy;
9092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
9093 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9094 *ret_copy = COption_u32Z_none();
9095 uint64_t ret_ref = (uint64_t)ret_copy;
9099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9100 if ((_res & 1) != 0) return;
9101 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
9103 COption_u32Z_free(_res_conv);
9106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9107 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
9108 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9109 *ret_copy = COption_u32Z_clone(orig_conv);
9110 uint64_t ret_ref = (uint64_t)ret_copy;
9114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9115 LDKHTLCOutputInCommitment o_conv;
9116 o_conv.inner = (void*)(o & (~1));
9117 o_conv.is_owned = (o & 1) || (o == 0);
9118 o_conv = HTLCOutputInCommitment_clone(&o_conv);
9119 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9120 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
9121 return (uint64_t)ret_conv;
9124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9125 LDKDecodeError e_conv;
9126 e_conv.inner = (void*)(e & (~1));
9127 e_conv.is_owned = (e & 1) || (e == 0);
9128 e_conv = DecodeError_clone(&e_conv);
9129 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9130 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
9131 return (uint64_t)ret_conv;
9134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9135 if ((_res & 1) != 0) return;
9136 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
9138 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
9141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9142 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
9143 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9144 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
9145 return (uint64_t)ret_conv;
9148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9149 LDKCounterpartyChannelTransactionParameters o_conv;
9150 o_conv.inner = (void*)(o & (~1));
9151 o_conv.is_owned = (o & 1) || (o == 0);
9152 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
9153 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9154 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9155 return (uint64_t)ret_conv;
9158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9159 LDKDecodeError e_conv;
9160 e_conv.inner = (void*)(e & (~1));
9161 e_conv.is_owned = (e & 1) || (e == 0);
9162 e_conv = DecodeError_clone(&e_conv);
9163 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9164 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
9165 return (uint64_t)ret_conv;
9168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9169 if ((_res & 1) != 0) return;
9170 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
9172 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9176 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9177 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9178 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9179 return (uint64_t)ret_conv;
9182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9183 LDKChannelTransactionParameters o_conv;
9184 o_conv.inner = (void*)(o & (~1));
9185 o_conv.is_owned = (o & 1) || (o == 0);
9186 o_conv = ChannelTransactionParameters_clone(&o_conv);
9187 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9188 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9189 return (uint64_t)ret_conv;
9192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9193 LDKDecodeError e_conv;
9194 e_conv.inner = (void*)(e & (~1));
9195 e_conv.is_owned = (e & 1) || (e == 0);
9196 e_conv = DecodeError_clone(&e_conv);
9197 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9198 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
9199 return (uint64_t)ret_conv;
9202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9203 if ((_res & 1) != 0) return;
9204 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
9206 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9210 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9211 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9212 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9213 return (uint64_t)ret_conv;
9216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9217 LDKCVec_SignatureZ _res_constr;
9218 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9219 if (_res_constr.datalen > 0)
9220 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9222 _res_constr.data = NULL;
9223 for (size_t i = 0; i < _res_constr.datalen; i++) {
9224 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9225 LDKSignature _res_conv_8_ref;
9226 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
9227 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
9228 _res_constr.data[i] = _res_conv_8_ref;
9230 CVec_SignatureZ_free(_res_constr);
9233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9234 LDKHolderCommitmentTransaction o_conv;
9235 o_conv.inner = (void*)(o & (~1));
9236 o_conv.is_owned = (o & 1) || (o == 0);
9237 o_conv = HolderCommitmentTransaction_clone(&o_conv);
9238 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9239 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
9240 return (uint64_t)ret_conv;
9243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9244 LDKDecodeError e_conv;
9245 e_conv.inner = (void*)(e & (~1));
9246 e_conv.is_owned = (e & 1) || (e == 0);
9247 e_conv = DecodeError_clone(&e_conv);
9248 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9249 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
9250 return (uint64_t)ret_conv;
9253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9254 if ((_res & 1) != 0) return;
9255 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9257 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
9260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9261 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9262 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9263 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9264 return (uint64_t)ret_conv;
9267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9268 LDKBuiltCommitmentTransaction o_conv;
9269 o_conv.inner = (void*)(o & (~1));
9270 o_conv.is_owned = (o & 1) || (o == 0);
9271 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
9272 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9273 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
9274 return (uint64_t)ret_conv;
9277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9278 LDKDecodeError e_conv;
9279 e_conv.inner = (void*)(e & (~1));
9280 e_conv.is_owned = (e & 1) || (e == 0);
9281 e_conv = DecodeError_clone(&e_conv);
9282 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9283 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
9284 return (uint64_t)ret_conv;
9287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9288 if ((_res & 1) != 0) return;
9289 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9291 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
9294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9295 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9296 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9297 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9298 return (uint64_t)ret_conv;
9301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9302 LDKCommitmentTransaction o_conv;
9303 o_conv.inner = (void*)(o & (~1));
9304 o_conv.is_owned = (o & 1) || (o == 0);
9305 o_conv = CommitmentTransaction_clone(&o_conv);
9306 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9307 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9308 return (uint64_t)ret_conv;
9311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9312 LDKDecodeError e_conv;
9313 e_conv.inner = (void*)(e & (~1));
9314 e_conv.is_owned = (e & 1) || (e == 0);
9315 e_conv = DecodeError_clone(&e_conv);
9316 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9317 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9318 return (uint64_t)ret_conv;
9321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9322 if ((_res & 1) != 0) return;
9323 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9325 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9329 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9330 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9331 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9332 return (uint64_t)ret_conv;
9335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9336 LDKTrustedCommitmentTransaction o_conv;
9337 o_conv.inner = (void*)(o & (~1));
9338 o_conv.is_owned = (o & 1) || (o == 0);
9339 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9340 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9341 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9342 return (uint64_t)ret_conv;
9345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
9346 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9347 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9348 return (uint64_t)ret_conv;
9351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9352 if ((_res & 1) != 0) return;
9353 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
9355 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9359 LDKCVec_SignatureZ o_constr;
9360 o_constr.datalen = (*env)->GetArrayLength(env, o);
9361 if (o_constr.datalen > 0)
9362 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9364 o_constr.data = NULL;
9365 for (size_t i = 0; i < o_constr.datalen; i++) {
9366 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9367 LDKSignature o_conv_8_ref;
9368 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
9369 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
9370 o_constr.data[i] = o_conv_8_ref;
9372 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9373 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9374 return (uint64_t)ret_conv;
9377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
9378 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9379 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9380 return (uint64_t)ret_conv;
9383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9384 if ((_res & 1) != 0) return;
9385 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
9387 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9391 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9392 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9393 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9394 return (uint64_t)ret_conv;
9397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
9398 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9399 *ret_conv = CResult_NoneErrorZ_ok();
9400 return (uint64_t)ret_conv;
9403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9404 LDKIOError e_conv = LDKIOError_from_java(env, e);
9405 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9406 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9407 return (uint64_t)ret_conv;
9410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9411 if ((_res & 1) != 0) return;
9412 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
9414 CResult_NoneErrorZ_free(_res_conv);
9417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9418 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9419 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9420 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9421 return (uint64_t)ret_conv;
9424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9426 o_conv.inner = (void*)(o & (~1));
9427 o_conv.is_owned = (o & 1) || (o == 0);
9428 o_conv = RouteHop_clone(&o_conv);
9429 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9430 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9431 return (uint64_t)ret_conv;
9434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9435 LDKDecodeError e_conv;
9436 e_conv.inner = (void*)(e & (~1));
9437 e_conv.is_owned = (e & 1) || (e == 0);
9438 e_conv = DecodeError_clone(&e_conv);
9439 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9440 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9441 return (uint64_t)ret_conv;
9444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9445 if ((_res & 1) != 0) return;
9446 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
9448 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9452 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9453 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9454 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9455 return (uint64_t)ret_conv;
9458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9459 LDKCVec_RouteHopZ _res_constr;
9460 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9461 if (_res_constr.datalen > 0)
9462 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9464 _res_constr.data = NULL;
9465 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9466 for (size_t k = 0; k < _res_constr.datalen; k++) {
9467 int64_t _res_conv_10 = _res_vals[k];
9468 LDKRouteHop _res_conv_10_conv;
9469 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9470 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9471 _res_constr.data[k] = _res_conv_10_conv;
9473 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9474 CVec_RouteHopZ_free(_res_constr);
9477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9478 LDKCVec_CVec_RouteHopZZ _res_constr;
9479 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9480 if (_res_constr.datalen > 0)
9481 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9483 _res_constr.data = NULL;
9484 for (size_t m = 0; m < _res_constr.datalen; m++) {
9485 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
9486 LDKCVec_RouteHopZ _res_conv_12_constr;
9487 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
9488 if (_res_conv_12_constr.datalen > 0)
9489 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9491 _res_conv_12_constr.data = NULL;
9492 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
9493 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9494 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9495 LDKRouteHop _res_conv_12_conv_10_conv;
9496 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9497 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9498 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9500 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
9501 _res_constr.data[m] = _res_conv_12_constr;
9503 CVec_CVec_RouteHopZZ_free(_res_constr);
9506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9508 o_conv.inner = (void*)(o & (~1));
9509 o_conv.is_owned = (o & 1) || (o == 0);
9510 o_conv = Route_clone(&o_conv);
9511 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9512 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9513 return (uint64_t)ret_conv;
9516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9517 LDKDecodeError e_conv;
9518 e_conv.inner = (void*)(e & (~1));
9519 e_conv.is_owned = (e & 1) || (e == 0);
9520 e_conv = DecodeError_clone(&e_conv);
9521 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9522 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9523 return (uint64_t)ret_conv;
9526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9527 if ((_res & 1) != 0) return;
9528 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
9530 CResult_RouteDecodeErrorZ_free(_res_conv);
9533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9534 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9535 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9536 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9537 return (uint64_t)ret_conv;
9540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
9541 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9542 *ret_copy = COption_u64Z_some(o);
9543 uint64_t ret_ref = (uint64_t)ret_copy;
9547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
9548 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9549 *ret_copy = COption_u64Z_none();
9550 uint64_t ret_ref = (uint64_t)ret_copy;
9554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9555 if ((_res & 1) != 0) return;
9556 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
9558 COption_u64Z_free(_res_conv);
9561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9562 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9563 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9564 *ret_copy = COption_u64Z_clone(orig_conv);
9565 uint64_t ret_ref = (uint64_t)ret_copy;
9569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9570 LDKCVec_ChannelDetailsZ _res_constr;
9571 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9572 if (_res_constr.datalen > 0)
9573 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9575 _res_constr.data = NULL;
9576 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9577 for (size_t q = 0; q < _res_constr.datalen; q++) {
9578 int64_t _res_conv_16 = _res_vals[q];
9579 LDKChannelDetails _res_conv_16_conv;
9580 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9581 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9582 _res_constr.data[q] = _res_conv_16_conv;
9584 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9585 CVec_ChannelDetailsZ_free(_res_constr);
9588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9589 LDKCVec_RouteHintZ _res_constr;
9590 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9591 if (_res_constr.datalen > 0)
9592 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9594 _res_constr.data = NULL;
9595 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9596 for (size_t l = 0; l < _res_constr.datalen; l++) {
9597 int64_t _res_conv_11 = _res_vals[l];
9598 LDKRouteHint _res_conv_11_conv;
9599 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9600 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9601 _res_constr.data[l] = _res_conv_11_conv;
9603 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9604 CVec_RouteHintZ_free(_res_constr);
9607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9609 o_conv.inner = (void*)(o & (~1));
9610 o_conv.is_owned = (o & 1) || (o == 0);
9611 o_conv = Route_clone(&o_conv);
9612 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9613 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9614 return (uint64_t)ret_conv;
9617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9618 LDKLightningError e_conv;
9619 e_conv.inner = (void*)(e & (~1));
9620 e_conv.is_owned = (e & 1) || (e == 0);
9621 e_conv = LightningError_clone(&e_conv);
9622 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9623 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9624 return (uint64_t)ret_conv;
9627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9628 if ((_res & 1) != 0) return;
9629 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
9631 CResult_RouteLightningErrorZ_free(_res_conv);
9634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9635 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9636 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9637 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9638 return (uint64_t)ret_conv;
9641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9642 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
9643 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9644 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9645 return (uint64_t)ret_conv;
9648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9649 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
9650 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9651 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9652 return (uint64_t)ret_conv;
9655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9656 if ((_res & 1) != 0) return;
9657 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
9659 CResult_TxOutAccessErrorZ_free(_res_conv);
9662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9663 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9664 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9665 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9666 return (uint64_t)ret_conv;
9669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9670 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9671 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9672 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
9673 return (uint64_t)ret_ref;
9676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
9677 LDKTransaction b_ref;
9678 b_ref.datalen = (*env)->GetArrayLength(env, b);
9679 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9680 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
9681 b_ref.data_is_owned = true;
9682 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9683 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
9684 return (uint64_t)ret_ref;
9687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9688 if ((_res & 1) != 0) return;
9689 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
9691 C2Tuple_usizeTransactionZ_free(_res_conv);
9694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9695 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9696 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9697 if (_res_constr.datalen > 0)
9698 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9700 _res_constr.data = NULL;
9701 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9702 for (size_t y = 0; y < _res_constr.datalen; y++) {
9703 int64_t _res_conv_24 = _res_vals[y];
9704 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
9705 FREE((void*)_res_conv_24);
9706 _res_constr.data[y] = _res_conv_24_conv;
9708 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9709 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9713 LDKCVec_TxidZ _res_constr;
9714 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9715 if (_res_constr.datalen > 0)
9716 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9718 _res_constr.data = NULL;
9719 for (size_t i = 0; i < _res_constr.datalen; i++) {
9720 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9721 LDKThirtyTwoBytes _res_conv_8_ref;
9722 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
9723 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
9724 _res_constr.data[i] = _res_conv_8_ref;
9726 CVec_TxidZ_free(_res_constr);
9729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
9730 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9731 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9732 return (uint64_t)ret_conv;
9735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
9736 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
9737 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9738 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9739 return (uint64_t)ret_conv;
9742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9743 if ((_res & 1) != 0) return;
9744 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
9746 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9750 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9751 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9752 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9753 return (uint64_t)ret_conv;
9756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9757 LDKCVec_MonitorEventZ _res_constr;
9758 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9759 if (_res_constr.datalen > 0)
9760 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9762 _res_constr.data = NULL;
9763 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9764 for (size_t o = 0; o < _res_constr.datalen; o++) {
9765 int64_t _res_conv_14 = _res_vals[o];
9766 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
9767 FREE((void*)_res_conv_14);
9768 _res_constr.data[o] = _res_conv_14_conv;
9770 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9771 CVec_MonitorEventZ_free(_res_constr);
9774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
9775 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
9776 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9777 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9778 uint64_t ret_ref = (uint64_t)ret_copy;
9782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
9783 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9784 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
9785 uint64_t ret_ref = (uint64_t)ret_copy;
9789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9790 if ((_res & 1) != 0) return;
9791 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
9793 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
9796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9797 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
9798 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9799 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
9800 uint64_t ret_ref = (uint64_t)ret_copy;
9804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9805 LDKCVec_SpendableOutputDescriptorZ _res_constr;
9806 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9807 if (_res_constr.datalen > 0)
9808 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
9810 _res_constr.data = NULL;
9811 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9812 for (size_t b = 0; b < _res_constr.datalen; b++) {
9813 int64_t _res_conv_27 = _res_vals[b];
9814 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
9815 FREE((void*)_res_conv_27);
9816 _res_constr.data[b] = _res_conv_27_conv;
9818 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9819 CVec_SpendableOutputDescriptorZ_free(_res_constr);
9822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9823 LDKCVec_MessageSendEventZ _res_constr;
9824 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9825 if (_res_constr.datalen > 0)
9826 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9828 _res_constr.data = NULL;
9829 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9830 for (size_t s = 0; s < _res_constr.datalen; s++) {
9831 int64_t _res_conv_18 = _res_vals[s];
9832 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
9833 FREE((void*)_res_conv_18);
9834 _res_constr.data[s] = _res_conv_18_conv;
9836 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9837 CVec_MessageSendEventZ_free(_res_constr);
9840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9841 LDKInitFeatures o_conv;
9842 o_conv.inner = (void*)(o & (~1));
9843 o_conv.is_owned = (o & 1) || (o == 0);
9844 o_conv = InitFeatures_clone(&o_conv);
9845 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9846 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
9847 return (uint64_t)ret_conv;
9850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9851 LDKDecodeError e_conv;
9852 e_conv.inner = (void*)(e & (~1));
9853 e_conv.is_owned = (e & 1) || (e == 0);
9854 e_conv = DecodeError_clone(&e_conv);
9855 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9856 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
9857 return (uint64_t)ret_conv;
9860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9861 if ((_res & 1) != 0) return;
9862 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9864 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
9867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9868 LDKNodeFeatures o_conv;
9869 o_conv.inner = (void*)(o & (~1));
9870 o_conv.is_owned = (o & 1) || (o == 0);
9871 o_conv = NodeFeatures_clone(&o_conv);
9872 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9873 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
9874 return (uint64_t)ret_conv;
9877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9878 LDKDecodeError e_conv;
9879 e_conv.inner = (void*)(e & (~1));
9880 e_conv.is_owned = (e & 1) || (e == 0);
9881 e_conv = DecodeError_clone(&e_conv);
9882 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9883 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
9884 return (uint64_t)ret_conv;
9887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9888 if ((_res & 1) != 0) return;
9889 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9891 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
9894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9895 LDKChannelFeatures o_conv;
9896 o_conv.inner = (void*)(o & (~1));
9897 o_conv.is_owned = (o & 1) || (o == 0);
9898 o_conv = ChannelFeatures_clone(&o_conv);
9899 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9900 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
9901 return (uint64_t)ret_conv;
9904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9905 LDKDecodeError e_conv;
9906 e_conv.inner = (void*)(e & (~1));
9907 e_conv.is_owned = (e & 1) || (e == 0);
9908 e_conv = DecodeError_clone(&e_conv);
9909 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9910 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
9911 return (uint64_t)ret_conv;
9914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9915 if ((_res & 1) != 0) return;
9916 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9918 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
9921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9922 LDKInvoiceFeatures o_conv;
9923 o_conv.inner = (void*)(o & (~1));
9924 o_conv.is_owned = (o & 1) || (o == 0);
9925 o_conv = InvoiceFeatures_clone(&o_conv);
9926 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9927 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
9928 return (uint64_t)ret_conv;
9931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9932 LDKDecodeError e_conv;
9933 e_conv.inner = (void*)(e & (~1));
9934 e_conv.is_owned = (e & 1) || (e == 0);
9935 e_conv = DecodeError_clone(&e_conv);
9936 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9937 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
9938 return (uint64_t)ret_conv;
9941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9942 if ((_res & 1) != 0) return;
9943 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9945 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
9948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9949 LDKDelayedPaymentOutputDescriptor o_conv;
9950 o_conv.inner = (void*)(o & (~1));
9951 o_conv.is_owned = (o & 1) || (o == 0);
9952 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
9953 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9954 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9955 return (uint64_t)ret_conv;
9958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9959 LDKDecodeError e_conv;
9960 e_conv.inner = (void*)(e & (~1));
9961 e_conv.is_owned = (e & 1) || (e == 0);
9962 e_conv = DecodeError_clone(&e_conv);
9963 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9964 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9965 return (uint64_t)ret_conv;
9968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9969 if ((_res & 1) != 0) return;
9970 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9972 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9976 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9977 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9978 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9979 return (uint64_t)ret_conv;
9982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9983 LDKStaticPaymentOutputDescriptor o_conv;
9984 o_conv.inner = (void*)(o & (~1));
9985 o_conv.is_owned = (o & 1) || (o == 0);
9986 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
9987 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9988 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9989 return (uint64_t)ret_conv;
9992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9993 LDKDecodeError e_conv;
9994 e_conv.inner = (void*)(e & (~1));
9995 e_conv.is_owned = (e & 1) || (e == 0);
9996 e_conv = DecodeError_clone(&e_conv);
9997 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9998 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9999 return (uint64_t)ret_conv;
10002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10003 if ((_res & 1) != 0) return;
10004 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10006 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10010 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10011 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10012 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10013 return (uint64_t)ret_conv;
10016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10017 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
10018 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10019 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
10020 return (uint64_t)ret_conv;
10023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10024 LDKDecodeError e_conv;
10025 e_conv.inner = (void*)(e & (~1));
10026 e_conv.is_owned = (e & 1) || (e == 0);
10027 e_conv = DecodeError_clone(&e_conv);
10028 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10029 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
10030 return (uint64_t)ret_conv;
10033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10034 if ((_res & 1) != 0) return;
10035 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10037 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
10040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10041 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
10042 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10043 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
10044 return (uint64_t)ret_conv;
10047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10048 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
10049 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10050 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
10051 return (uint64_t)ret_ref;
10054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
10055 LDKSignature a_ref;
10056 CHECK((*env)->GetArrayLength(env, a) == 64);
10057 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
10058 LDKCVec_SignatureZ b_constr;
10059 b_constr.datalen = (*env)->GetArrayLength(env, b);
10060 if (b_constr.datalen > 0)
10061 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10063 b_constr.data = NULL;
10064 for (size_t i = 0; i < b_constr.datalen; i++) {
10065 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
10066 LDKSignature b_conv_8_ref;
10067 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
10068 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
10069 b_constr.data[i] = b_conv_8_ref;
10071 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10072 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
10073 return (uint64_t)ret_ref;
10076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10077 if ((_res & 1) != 0) return;
10078 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
10080 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
10083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10084 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
10085 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10086 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
10087 return (uint64_t)ret_conv;
10090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
10091 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10092 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
10093 return (uint64_t)ret_conv;
10096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10097 if ((_res & 1) != 0) return;
10098 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
10100 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
10103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10104 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
10105 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10106 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
10107 return (uint64_t)ret_conv;
10110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10111 LDKSignature o_ref;
10112 CHECK((*env)->GetArrayLength(env, o) == 64);
10113 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
10114 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10115 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
10116 return (uint64_t)ret_conv;
10119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
10120 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10121 *ret_conv = CResult_SignatureNoneZ_err();
10122 return (uint64_t)ret_conv;
10125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10126 if ((_res & 1) != 0) return;
10127 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
10129 CResult_SignatureNoneZ_free(_res_conv);
10132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10133 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
10134 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10135 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
10136 return (uint64_t)ret_conv;
10139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10140 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
10141 if (o_conv.free == LDKSign_JCalls_free) {
10142 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10143 LDKSign_JCalls_clone(o_conv.this_arg);
10145 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10146 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
10147 return (uint64_t)ret_conv;
10150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10151 LDKDecodeError e_conv;
10152 e_conv.inner = (void*)(e & (~1));
10153 e_conv.is_owned = (e & 1) || (e == 0);
10154 e_conv = DecodeError_clone(&e_conv);
10155 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10156 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
10157 return (uint64_t)ret_conv;
10160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10161 if ((_res & 1) != 0) return;
10162 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
10164 CResult_SignDecodeErrorZ_free(_res_conv);
10167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10168 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
10169 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10170 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
10171 return (uint64_t)ret_conv;
10174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
10175 LDKCVec_u8Z _res_ref;
10176 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
10177 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
10178 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
10179 CVec_u8Z_free(_res_ref);
10182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
10183 LDKRecoverableSignature arg_ref;
10184 CHECK((*env)->GetArrayLength(env, arg) == 68);
10185 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
10186 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10187 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
10188 return (uint64_t)ret_conv;
10191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
10192 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10193 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
10194 return (uint64_t)ret_conv;
10197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10198 if ((_res & 1) != 0) return;
10199 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
10201 CResult_RecoverableSignatureNoneZ_free(_res_conv);
10204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10205 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
10206 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10207 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
10208 return (uint64_t)ret_conv;
10211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10212 LDKCVec_CVec_u8ZZ _res_constr;
10213 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10214 if (_res_constr.datalen > 0)
10215 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10217 _res_constr.data = NULL;
10218 for (size_t i = 0; i < _res_constr.datalen; i++) {
10219 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10220 LDKCVec_u8Z _res_conv_8_ref;
10221 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
10222 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
10223 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
10224 _res_constr.data[i] = _res_conv_8_ref;
10226 CVec_CVec_u8ZZ_free(_res_constr);
10229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
10230 LDKCVec_CVec_u8ZZ o_constr;
10231 o_constr.datalen = (*env)->GetArrayLength(env, o);
10232 if (o_constr.datalen > 0)
10233 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10235 o_constr.data = NULL;
10236 for (size_t i = 0; i < o_constr.datalen; i++) {
10237 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
10238 LDKCVec_u8Z o_conv_8_ref;
10239 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
10240 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
10241 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
10242 o_constr.data[i] = o_conv_8_ref;
10244 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10245 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
10246 return (uint64_t)ret_conv;
10249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
10250 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10251 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
10252 return (uint64_t)ret_conv;
10255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10256 if ((_res & 1) != 0) return;
10257 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
10259 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
10262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10263 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
10264 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10265 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
10266 return (uint64_t)ret_conv;
10269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10270 LDKInMemorySigner o_conv;
10271 o_conv.inner = (void*)(o & (~1));
10272 o_conv.is_owned = (o & 1) || (o == 0);
10273 o_conv = InMemorySigner_clone(&o_conv);
10274 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10275 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
10276 return (uint64_t)ret_conv;
10279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10280 LDKDecodeError e_conv;
10281 e_conv.inner = (void*)(e & (~1));
10282 e_conv.is_owned = (e & 1) || (e == 0);
10283 e_conv = DecodeError_clone(&e_conv);
10284 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10285 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
10286 return (uint64_t)ret_conv;
10289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10290 if ((_res & 1) != 0) return;
10291 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
10293 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
10296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10297 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
10298 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10299 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
10300 return (uint64_t)ret_conv;
10303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10304 LDKCVec_TxOutZ _res_constr;
10305 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10306 if (_res_constr.datalen > 0)
10307 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10309 _res_constr.data = NULL;
10310 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10311 for (size_t h = 0; h < _res_constr.datalen; h++) {
10312 int64_t _res_conv_7 = _res_vals[h];
10313 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
10314 FREE((void*)_res_conv_7);
10315 _res_constr.data[h] = _res_conv_7_conv;
10317 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10318 CVec_TxOutZ_free(_res_constr);
10321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10322 LDKTransaction o_ref;
10323 o_ref.datalen = (*env)->GetArrayLength(env, o);
10324 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10325 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
10326 o_ref.data_is_owned = true;
10327 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10328 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10329 return (uint64_t)ret_conv;
10332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10333 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10334 *ret_conv = CResult_TransactionNoneZ_err();
10335 return (uint64_t)ret_conv;
10338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10339 if ((_res & 1) != 0) return;
10340 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
10342 CResult_TransactionNoneZ_free(_res_conv);
10345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10346 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10347 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10348 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10349 return (uint64_t)ret_conv;
10352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10353 LDKThirtyTwoBytes a_ref;
10354 CHECK((*env)->GetArrayLength(env, a) == 32);
10355 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10356 LDKChannelMonitor b_conv;
10357 b_conv.inner = (void*)(b & (~1));
10358 b_conv.is_owned = (b & 1) || (b == 0);
10359 b_conv = ChannelMonitor_clone(&b_conv);
10360 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10361 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10362 return (uint64_t)ret_ref;
10365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10366 if ((_res & 1) != 0) return;
10367 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
10369 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10373 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10374 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10375 if (_res_constr.datalen > 0)
10376 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10378 _res_constr.data = NULL;
10379 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10380 for (size_t i = 0; i < _res_constr.datalen; i++) {
10381 int64_t _res_conv_34 = _res_vals[i];
10382 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
10383 FREE((void*)_res_conv_34);
10384 _res_constr.data[i] = _res_conv_34_conv;
10386 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10387 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
10391 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10392 o_constr.datalen = (*env)->GetArrayLength(env, o);
10393 if (o_constr.datalen > 0)
10394 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10396 o_constr.data = NULL;
10397 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
10398 for (size_t i = 0; i < o_constr.datalen; i++) {
10399 int64_t o_conv_34 = o_vals[i];
10400 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
10401 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
10402 o_constr.data[i] = o_conv_34_conv;
10404 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
10405 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10406 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10407 return (uint64_t)ret_conv;
10410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10411 LDKIOError e_conv = LDKIOError_from_java(env, e);
10412 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10413 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10414 return (uint64_t)ret_conv;
10417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10418 if ((_res & 1) != 0) return;
10419 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
10421 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
10425 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10426 *ret_conv = CResult_NoneAPIErrorZ_ok();
10427 return (uint64_t)ret_conv;
10430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10431 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10432 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10433 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10434 return (uint64_t)ret_conv;
10437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10438 if ((_res & 1) != 0) return;
10439 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
10441 CResult_NoneAPIErrorZ_free(_res_conv);
10444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10445 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10446 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10447 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10448 return (uint64_t)ret_conv;
10451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10452 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
10453 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10454 if (_res_constr.datalen > 0)
10455 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
10457 _res_constr.data = NULL;
10458 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10459 for (size_t w = 0; w < _res_constr.datalen; w++) {
10460 int64_t _res_conv_22 = _res_vals[w];
10461 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
10462 FREE((void*)_res_conv_22);
10463 _res_constr.data[w] = _res_conv_22_conv;
10465 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10466 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
10469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10470 LDKCVec_APIErrorZ _res_constr;
10471 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10472 if (_res_constr.datalen > 0)
10473 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
10475 _res_constr.data = NULL;
10476 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10477 for (size_t k = 0; k < _res_constr.datalen; k++) {
10478 int64_t _res_conv_10 = _res_vals[k];
10479 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
10480 FREE((void*)_res_conv_10);
10481 _res_constr.data[k] = _res_conv_10_conv;
10483 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10484 CVec_APIErrorZ_free(_res_constr);
10487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
10488 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10489 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
10490 return (uint64_t)ret_conv;
10493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10494 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10495 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10496 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
10497 return (uint64_t)ret_conv;
10500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10501 if ((_res & 1) != 0) return;
10502 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10504 CResult_NonePaymentSendFailureZ_free(_res_conv);
10507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10508 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
10509 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10510 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
10511 return (uint64_t)ret_conv;
10514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10515 LDKCVec_NetAddressZ _res_constr;
10516 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10517 if (_res_constr.datalen > 0)
10518 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10520 _res_constr.data = NULL;
10521 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10522 for (size_t m = 0; m < _res_constr.datalen; m++) {
10523 int64_t _res_conv_12 = _res_vals[m];
10524 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
10525 FREE((void*)_res_conv_12);
10526 _res_constr.data[m] = _res_conv_12_conv;
10528 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10529 CVec_NetAddressZ_free(_res_constr);
10532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10533 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
10534 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10535 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
10536 return (uint64_t)ret_ref;
10539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
10540 LDKThirtyTwoBytes a_ref;
10541 CHECK((*env)->GetArrayLength(env, a) == 32);
10542 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10543 LDKThirtyTwoBytes b_ref;
10544 CHECK((*env)->GetArrayLength(env, b) == 32);
10545 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10546 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10547 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
10548 return (uint64_t)ret_ref;
10551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10552 if ((_res & 1) != 0) return;
10553 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
10555 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
10558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10559 LDKThirtyTwoBytes o_ref;
10560 CHECK((*env)->GetArrayLength(env, o) == 32);
10561 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10562 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10563 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
10564 return (uint64_t)ret_conv;
10567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10568 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10569 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10570 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
10571 return (uint64_t)ret_conv;
10574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10575 if ((_res & 1) != 0) return;
10576 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
10578 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
10581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10582 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
10583 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10584 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
10585 return (uint64_t)ret_conv;
10588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10589 LDKCVec_ChannelMonitorZ _res_constr;
10590 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10591 if (_res_constr.datalen > 0)
10592 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10594 _res_constr.data = NULL;
10595 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10596 for (size_t q = 0; q < _res_constr.datalen; q++) {
10597 int64_t _res_conv_16 = _res_vals[q];
10598 LDKChannelMonitor _res_conv_16_conv;
10599 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10600 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10601 _res_constr.data[q] = _res_conv_16_conv;
10603 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10604 CVec_ChannelMonitorZ_free(_res_constr);
10607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10608 LDKThirtyTwoBytes a_ref;
10609 CHECK((*env)->GetArrayLength(env, a) == 32);
10610 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10611 LDKChannelManager b_conv;
10612 b_conv.inner = (void*)(b & (~1));
10613 b_conv.is_owned = (b & 1) || (b == 0);
10614 // Warning: we need a move here but no clone is available for LDKChannelManager
10615 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
10616 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
10617 return (uint64_t)ret_ref;
10620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10621 if ((_res & 1) != 0) return;
10622 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
10624 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
10627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10628 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
10629 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10630 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
10631 return (uint64_t)ret_conv;
10634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10635 LDKDecodeError e_conv;
10636 e_conv.inner = (void*)(e & (~1));
10637 e_conv.is_owned = (e & 1) || (e == 0);
10638 e_conv = DecodeError_clone(&e_conv);
10639 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10640 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
10641 return (uint64_t)ret_conv;
10644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10645 if ((_res & 1) != 0) return;
10646 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10648 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
10651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10652 LDKChannelConfig o_conv;
10653 o_conv.inner = (void*)(o & (~1));
10654 o_conv.is_owned = (o & 1) || (o == 0);
10655 o_conv = ChannelConfig_clone(&o_conv);
10656 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10657 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
10658 return (uint64_t)ret_conv;
10661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10662 LDKDecodeError e_conv;
10663 e_conv.inner = (void*)(e & (~1));
10664 e_conv.is_owned = (e & 1) || (e == 0);
10665 e_conv = DecodeError_clone(&e_conv);
10666 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10667 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
10668 return (uint64_t)ret_conv;
10671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10672 if ((_res & 1) != 0) return;
10673 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
10675 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
10678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10679 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
10680 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10681 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
10682 return (uint64_t)ret_conv;
10685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10686 LDKOutPoint o_conv;
10687 o_conv.inner = (void*)(o & (~1));
10688 o_conv.is_owned = (o & 1) || (o == 0);
10689 o_conv = OutPoint_clone(&o_conv);
10690 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10691 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
10692 return (uint64_t)ret_conv;
10695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10696 LDKDecodeError e_conv;
10697 e_conv.inner = (void*)(e & (~1));
10698 e_conv.is_owned = (e & 1) || (e == 0);
10699 e_conv = DecodeError_clone(&e_conv);
10700 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10701 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
10702 return (uint64_t)ret_conv;
10705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10706 if ((_res & 1) != 0) return;
10707 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
10709 CResult_OutPointDecodeErrorZ_free(_res_conv);
10712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10713 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
10714 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10715 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
10716 return (uint64_t)ret_conv;
10719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
10720 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
10721 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10722 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
10723 return (uint64_t)ret_conv;
10726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
10727 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10728 *ret_conv = CResult_SiPrefixNoneZ_err();
10729 return (uint64_t)ret_conv;
10732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10733 if ((_res & 1) != 0) return;
10734 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
10736 CResult_SiPrefixNoneZ_free(_res_conv);
10739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10740 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
10741 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10742 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
10743 return (uint64_t)ret_conv;
10746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10748 o_conv.inner = (void*)(o & (~1));
10749 o_conv.is_owned = (o & 1) || (o == 0);
10750 o_conv = Invoice_clone(&o_conv);
10751 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10752 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
10753 return (uint64_t)ret_conv;
10756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10757 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10758 *ret_conv = CResult_InvoiceNoneZ_err();
10759 return (uint64_t)ret_conv;
10762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10763 if ((_res & 1) != 0) return;
10764 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
10766 CResult_InvoiceNoneZ_free(_res_conv);
10769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10770 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
10771 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10772 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
10773 return (uint64_t)ret_conv;
10776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10777 LDKSignedRawInvoice o_conv;
10778 o_conv.inner = (void*)(o & (~1));
10779 o_conv.is_owned = (o & 1) || (o == 0);
10780 o_conv = SignedRawInvoice_clone(&o_conv);
10781 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10782 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
10783 return (uint64_t)ret_conv;
10786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10787 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10788 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
10789 return (uint64_t)ret_conv;
10792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10793 if ((_res & 1) != 0) return;
10794 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
10796 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
10799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10800 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
10801 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10802 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
10803 return (uint64_t)ret_conv;
10806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10807 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
10808 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10809 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
10810 return (uint64_t)ret_ref;
10813 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) {
10814 LDKRawInvoice a_conv;
10815 a_conv.inner = (void*)(a & (~1));
10816 a_conv.is_owned = (a & 1) || (a == 0);
10817 a_conv = RawInvoice_clone(&a_conv);
10818 LDKThirtyTwoBytes b_ref;
10819 CHECK((*env)->GetArrayLength(env, b) == 32);
10820 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10821 LDKInvoiceSignature c_conv;
10822 c_conv.inner = (void*)(c & (~1));
10823 c_conv.is_owned = (c & 1) || (c == 0);
10824 c_conv = InvoiceSignature_clone(&c_conv);
10825 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10826 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
10827 return (uint64_t)ret_ref;
10830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10831 if ((_res & 1) != 0) return;
10832 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
10834 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
10837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10838 LDKPayeePubKey o_conv;
10839 o_conv.inner = (void*)(o & (~1));
10840 o_conv.is_owned = (o & 1) || (o == 0);
10841 o_conv = PayeePubKey_clone(&o_conv);
10842 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10843 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
10844 return (uint64_t)ret_conv;
10847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10848 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10849 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10850 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
10851 return (uint64_t)ret_conv;
10854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10855 if ((_res & 1) != 0) return;
10856 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
10858 CResult_PayeePubKeyErrorZ_free(_res_conv);
10861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10862 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
10863 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10864 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
10865 return (uint64_t)ret_conv;
10868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10869 LDKCVec_PrivateRouteZ _res_constr;
10870 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10871 if (_res_constr.datalen > 0)
10872 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
10874 _res_constr.data = NULL;
10875 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10876 for (size_t o = 0; o < _res_constr.datalen; o++) {
10877 int64_t _res_conv_14 = _res_vals[o];
10878 LDKPrivateRoute _res_conv_14_conv;
10879 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
10880 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
10881 _res_constr.data[o] = _res_conv_14_conv;
10883 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10884 CVec_PrivateRouteZ_free(_res_constr);
10887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10888 LDKPositiveTimestamp o_conv;
10889 o_conv.inner = (void*)(o & (~1));
10890 o_conv.is_owned = (o & 1) || (o == 0);
10891 o_conv = PositiveTimestamp_clone(&o_conv);
10892 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10893 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
10894 return (uint64_t)ret_conv;
10897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10898 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10899 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10900 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
10901 return (uint64_t)ret_conv;
10904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10905 if ((_res & 1) != 0) return;
10906 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
10908 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
10911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10912 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
10913 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10914 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
10915 return (uint64_t)ret_conv;
10918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
10919 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10920 *ret_conv = CResult_NoneSemanticErrorZ_ok();
10921 return (uint64_t)ret_conv;
10924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10925 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10926 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10927 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
10928 return (uint64_t)ret_conv;
10931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10932 if ((_res & 1) != 0) return;
10933 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
10935 CResult_NoneSemanticErrorZ_free(_res_conv);
10938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10939 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
10940 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10941 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
10942 return (uint64_t)ret_conv;
10945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10947 o_conv.inner = (void*)(o & (~1));
10948 o_conv.is_owned = (o & 1) || (o == 0);
10949 o_conv = Invoice_clone(&o_conv);
10950 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10951 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
10952 return (uint64_t)ret_conv;
10955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10956 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10957 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10958 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
10959 return (uint64_t)ret_conv;
10962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10963 if ((_res & 1) != 0) return;
10964 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
10966 CResult_InvoiceSemanticErrorZ_free(_res_conv);
10969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10970 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
10971 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10972 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
10973 return (uint64_t)ret_conv;
10976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10977 LDKDescription o_conv;
10978 o_conv.inner = (void*)(o & (~1));
10979 o_conv.is_owned = (o & 1) || (o == 0);
10980 o_conv = Description_clone(&o_conv);
10981 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10982 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
10983 return (uint64_t)ret_conv;
10986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10987 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10988 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10989 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
10990 return (uint64_t)ret_conv;
10993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10994 if ((_res & 1) != 0) return;
10995 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
10997 CResult_DescriptionCreationErrorZ_free(_res_conv);
11000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11001 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
11002 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11003 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
11004 return (uint64_t)ret_conv;
11007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11008 LDKExpiryTime o_conv;
11009 o_conv.inner = (void*)(o & (~1));
11010 o_conv.is_owned = (o & 1) || (o == 0);
11011 o_conv = ExpiryTime_clone(&o_conv);
11012 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11013 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
11014 return (uint64_t)ret_conv;
11017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11018 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11019 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11020 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
11021 return (uint64_t)ret_conv;
11024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11025 if ((_res & 1) != 0) return;
11026 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
11028 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
11031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11032 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
11033 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11034 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
11035 return (uint64_t)ret_conv;
11038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11039 LDKPrivateRoute o_conv;
11040 o_conv.inner = (void*)(o & (~1));
11041 o_conv.is_owned = (o & 1) || (o == 0);
11042 o_conv = PrivateRoute_clone(&o_conv);
11043 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11044 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
11045 return (uint64_t)ret_conv;
11048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11049 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11050 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11051 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
11052 return (uint64_t)ret_conv;
11055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11056 if ((_res & 1) != 0) return;
11057 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
11059 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
11062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11063 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
11064 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11065 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
11066 return (uint64_t)ret_conv;
11069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
11070 LDKStr o_conv = java_to_owned_str(env, o);
11071 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11072 *ret_conv = CResult_StringErrorZ_ok(o_conv);
11073 return (uint64_t)ret_conv;
11076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11077 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11078 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11079 *ret_conv = CResult_StringErrorZ_err(e_conv);
11080 return (uint64_t)ret_conv;
11083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11084 if ((_res & 1) != 0) return;
11085 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
11087 CResult_StringErrorZ_free(_res_conv);
11090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11091 LDKChannelMonitorUpdate o_conv;
11092 o_conv.inner = (void*)(o & (~1));
11093 o_conv.is_owned = (o & 1) || (o == 0);
11094 o_conv = ChannelMonitorUpdate_clone(&o_conv);
11095 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11096 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
11097 return (uint64_t)ret_conv;
11100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11101 LDKDecodeError e_conv;
11102 e_conv.inner = (void*)(e & (~1));
11103 e_conv.is_owned = (e & 1) || (e == 0);
11104 e_conv = DecodeError_clone(&e_conv);
11105 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11106 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
11107 return (uint64_t)ret_conv;
11110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11111 if ((_res & 1) != 0) return;
11112 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11114 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
11117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11118 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
11119 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11120 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
11121 return (uint64_t)ret_conv;
11124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11125 LDKHTLCUpdate o_conv;
11126 o_conv.inner = (void*)(o & (~1));
11127 o_conv.is_owned = (o & 1) || (o == 0);
11128 o_conv = HTLCUpdate_clone(&o_conv);
11129 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11130 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
11131 return (uint64_t)ret_conv;
11134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11135 LDKDecodeError e_conv;
11136 e_conv.inner = (void*)(e & (~1));
11137 e_conv.is_owned = (e & 1) || (e == 0);
11138 e_conv = DecodeError_clone(&e_conv);
11139 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11140 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
11141 return (uint64_t)ret_conv;
11144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11145 if ((_res & 1) != 0) return;
11146 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11148 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
11151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11152 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
11153 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11154 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
11155 return (uint64_t)ret_conv;
11158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
11159 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11160 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
11161 return (uint64_t)ret_conv;
11164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11165 LDKMonitorUpdateError e_conv;
11166 e_conv.inner = (void*)(e & (~1));
11167 e_conv.is_owned = (e & 1) || (e == 0);
11168 e_conv = MonitorUpdateError_clone(&e_conv);
11169 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11170 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
11171 return (uint64_t)ret_conv;
11174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11175 if ((_res & 1) != 0) return;
11176 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
11178 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
11181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11182 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
11183 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11184 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
11185 return (uint64_t)ret_conv;
11188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11189 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
11190 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11191 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
11192 return (uint64_t)ret_ref;
11195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
11196 LDKOutPoint a_conv;
11197 a_conv.inner = (void*)(a & (~1));
11198 a_conv.is_owned = (a & 1) || (a == 0);
11199 a_conv = OutPoint_clone(&a_conv);
11201 b_ref.datalen = (*env)->GetArrayLength(env, b);
11202 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11203 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11204 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11205 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
11206 return (uint64_t)ret_ref;
11209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11210 if ((_res & 1) != 0) return;
11211 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
11213 C2Tuple_OutPointScriptZ_free(_res_conv);
11216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11217 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
11218 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11219 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
11220 return (uint64_t)ret_ref;
11223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
11225 b_ref.datalen = (*env)->GetArrayLength(env, b);
11226 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11227 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11228 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11229 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
11230 return (uint64_t)ret_ref;
11233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11234 if ((_res & 1) != 0) return;
11235 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
11237 C2Tuple_u32ScriptZ_free(_res_conv);
11240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11241 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
11242 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11243 if (_res_constr.datalen > 0)
11244 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11246 _res_constr.data = NULL;
11247 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11248 for (size_t b = 0; b < _res_constr.datalen; b++) {
11249 int64_t _res_conv_27 = _res_vals[b];
11250 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
11251 FREE((void*)_res_conv_27);
11252 _res_constr.data[b] = _res_conv_27_conv;
11254 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11255 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
11258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11259 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
11260 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11261 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
11262 return (uint64_t)ret_ref;
11265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11266 LDKThirtyTwoBytes a_ref;
11267 CHECK((*env)->GetArrayLength(env, a) == 32);
11268 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11269 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
11270 b_constr.datalen = (*env)->GetArrayLength(env, b);
11271 if (b_constr.datalen > 0)
11272 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11274 b_constr.data = NULL;
11275 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11276 for (size_t b = 0; b < b_constr.datalen; b++) {
11277 int64_t b_conv_27 = b_vals[b];
11278 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
11279 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
11280 b_constr.data[b] = b_conv_27_conv;
11282 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11283 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11284 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
11285 return (uint64_t)ret_ref;
11288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11289 if ((_res & 1) != 0) return;
11290 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
11292 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
11295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11296 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
11297 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11298 if (_res_constr.datalen > 0)
11299 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
11301 _res_constr.data = NULL;
11302 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11303 for (size_t v = 0; v < _res_constr.datalen; v++) {
11304 int64_t _res_conv_47 = _res_vals[v];
11305 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
11306 FREE((void*)_res_conv_47);
11307 _res_constr.data[v] = _res_conv_47_conv;
11309 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11310 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
11313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11314 LDKCVec_EventZ _res_constr;
11315 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11316 if (_res_constr.datalen > 0)
11317 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
11319 _res_constr.data = NULL;
11320 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11321 for (size_t h = 0; h < _res_constr.datalen; h++) {
11322 int64_t _res_conv_7 = _res_vals[h];
11323 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
11324 FREE((void*)_res_conv_7);
11325 _res_constr.data[h] = _res_conv_7_conv;
11327 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11328 CVec_EventZ_free(_res_constr);
11331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11332 LDKCVec_TransactionZ _res_constr;
11333 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11334 if (_res_constr.datalen > 0)
11335 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
11337 _res_constr.data = NULL;
11338 for (size_t i = 0; i < _res_constr.datalen; i++) {
11339 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11340 LDKTransaction _res_conv_8_ref;
11341 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11342 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
11343 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11344 _res_conv_8_ref.data_is_owned = true;
11345 _res_constr.data[i] = _res_conv_8_ref;
11347 CVec_TransactionZ_free(_res_constr);
11350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11351 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
11352 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11353 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
11354 return (uint64_t)ret_ref;
11357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
11358 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
11359 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11360 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
11361 return (uint64_t)ret_ref;
11364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11365 if ((_res & 1) != 0) return;
11366 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
11368 C2Tuple_u32TxOutZ_free(_res_conv);
11371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11372 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
11373 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11374 if (_res_constr.datalen > 0)
11375 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11377 _res_constr.data = NULL;
11378 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11379 for (size_t a = 0; a < _res_constr.datalen; a++) {
11380 int64_t _res_conv_26 = _res_vals[a];
11381 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
11382 FREE((void*)_res_conv_26);
11383 _res_constr.data[a] = _res_conv_26_conv;
11385 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11386 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
11389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11390 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
11391 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11392 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
11393 return (uint64_t)ret_ref;
11396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11397 LDKThirtyTwoBytes a_ref;
11398 CHECK((*env)->GetArrayLength(env, a) == 32);
11399 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11400 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
11401 b_constr.datalen = (*env)->GetArrayLength(env, b);
11402 if (b_constr.datalen > 0)
11403 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11405 b_constr.data = NULL;
11406 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11407 for (size_t a = 0; a < b_constr.datalen; a++) {
11408 int64_t b_conv_26 = b_vals[a];
11409 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
11410 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
11411 b_constr.data[a] = b_conv_26_conv;
11413 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11414 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11415 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
11416 return (uint64_t)ret_ref;
11419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11420 if ((_res & 1) != 0) return;
11421 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
11423 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
11426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11427 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
11428 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11429 if (_res_constr.datalen > 0)
11430 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
11432 _res_constr.data = NULL;
11433 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11434 for (size_t u = 0; u < _res_constr.datalen; u++) {
11435 int64_t _res_conv_46 = _res_vals[u];
11436 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
11437 FREE((void*)_res_conv_46);
11438 _res_constr.data[u] = _res_conv_46_conv;
11440 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11441 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
11444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11445 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
11446 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11447 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
11448 return (uint64_t)ret_conv;
11451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11452 LDKDecodeError e_conv;
11453 e_conv.inner = (void*)(e & (~1));
11454 e_conv.is_owned = (e & 1) || (e == 0);
11455 e_conv = DecodeError_clone(&e_conv);
11456 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11457 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
11458 return (uint64_t)ret_conv;
11461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11462 if ((_res & 1) != 0) return;
11463 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11465 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
11468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11469 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11470 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11471 return (uint64_t)ret_conv;
11474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11475 LDKLightningError e_conv;
11476 e_conv.inner = (void*)(e & (~1));
11477 e_conv.is_owned = (e & 1) || (e == 0);
11478 e_conv = LightningError_clone(&e_conv);
11479 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11480 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11481 return (uint64_t)ret_conv;
11484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11485 if ((_res & 1) != 0) return;
11486 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
11488 CResult_boolLightningErrorZ_free(_res_conv);
11491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11492 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11493 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11494 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11495 return (uint64_t)ret_conv;
11498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11499 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11500 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11501 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11502 return (uint64_t)ret_ref;
11505 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) {
11506 LDKChannelAnnouncement a_conv;
11507 a_conv.inner = (void*)(a & (~1));
11508 a_conv.is_owned = (a & 1) || (a == 0);
11509 a_conv = ChannelAnnouncement_clone(&a_conv);
11510 LDKChannelUpdate b_conv;
11511 b_conv.inner = (void*)(b & (~1));
11512 b_conv.is_owned = (b & 1) || (b == 0);
11513 b_conv = ChannelUpdate_clone(&b_conv);
11514 LDKChannelUpdate c_conv;
11515 c_conv.inner = (void*)(c & (~1));
11516 c_conv.is_owned = (c & 1) || (c == 0);
11517 c_conv = ChannelUpdate_clone(&c_conv);
11518 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11519 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11520 return (uint64_t)ret_ref;
11523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11524 if ((_res & 1) != 0) return;
11525 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
11527 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11531 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11532 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11533 if (_res_constr.datalen > 0)
11534 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11536 _res_constr.data = NULL;
11537 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11538 for (size_t l = 0; l < _res_constr.datalen; l++) {
11539 int64_t _res_conv_63 = _res_vals[l];
11540 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
11541 FREE((void*)_res_conv_63);
11542 _res_constr.data[l] = _res_conv_63_conv;
11544 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11545 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11549 LDKCVec_NodeAnnouncementZ _res_constr;
11550 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11551 if (_res_constr.datalen > 0)
11552 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11554 _res_constr.data = NULL;
11555 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11556 for (size_t s = 0; s < _res_constr.datalen; s++) {
11557 int64_t _res_conv_18 = _res_vals[s];
11558 LDKNodeAnnouncement _res_conv_18_conv;
11559 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11560 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11561 _res_constr.data[s] = _res_conv_18_conv;
11563 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11564 CVec_NodeAnnouncementZ_free(_res_constr);
11567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
11568 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11569 *ret_conv = CResult_NoneLightningErrorZ_ok();
11570 return (uint64_t)ret_conv;
11573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11574 LDKLightningError e_conv;
11575 e_conv.inner = (void*)(e & (~1));
11576 e_conv.is_owned = (e & 1) || (e == 0);
11577 e_conv = LightningError_clone(&e_conv);
11578 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11579 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11580 return (uint64_t)ret_conv;
11583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11584 if ((_res & 1) != 0) return;
11585 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
11587 CResult_NoneLightningErrorZ_free(_res_conv);
11590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11591 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11592 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11593 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11594 return (uint64_t)ret_conv;
11597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11598 LDKCVec_PublicKeyZ _res_constr;
11599 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11600 if (_res_constr.datalen > 0)
11601 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11603 _res_constr.data = NULL;
11604 for (size_t i = 0; i < _res_constr.datalen; i++) {
11605 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11606 LDKPublicKey _res_conv_8_ref;
11607 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
11608 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
11609 _res_constr.data[i] = _res_conv_8_ref;
11611 CVec_PublicKeyZ_free(_res_constr);
11614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11616 o_ref.datalen = (*env)->GetArrayLength(env, o);
11617 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11618 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11619 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11620 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11621 return (uint64_t)ret_conv;
11624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11625 LDKPeerHandleError e_conv;
11626 e_conv.inner = (void*)(e & (~1));
11627 e_conv.is_owned = (e & 1) || (e == 0);
11628 e_conv = PeerHandleError_clone(&e_conv);
11629 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11630 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11631 return (uint64_t)ret_conv;
11634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11635 if ((_res & 1) != 0) return;
11636 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11638 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11642 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11643 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11644 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11645 return (uint64_t)ret_conv;
11648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
11649 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11650 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11651 return (uint64_t)ret_conv;
11654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11655 LDKPeerHandleError e_conv;
11656 e_conv.inner = (void*)(e & (~1));
11657 e_conv.is_owned = (e & 1) || (e == 0);
11658 e_conv = PeerHandleError_clone(&e_conv);
11659 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11660 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11661 return (uint64_t)ret_conv;
11664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11665 if ((_res & 1) != 0) return;
11666 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11668 CResult_NonePeerHandleErrorZ_free(_res_conv);
11671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11672 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11673 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11674 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11675 return (uint64_t)ret_conv;
11678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11679 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11680 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11681 return (uint64_t)ret_conv;
11684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11685 LDKPeerHandleError e_conv;
11686 e_conv.inner = (void*)(e & (~1));
11687 e_conv.is_owned = (e & 1) || (e == 0);
11688 e_conv = PeerHandleError_clone(&e_conv);
11689 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11690 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11691 return (uint64_t)ret_conv;
11694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11695 if ((_res & 1) != 0) return;
11696 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11698 CResult_boolPeerHandleErrorZ_free(_res_conv);
11701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11702 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11703 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11704 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11705 return (uint64_t)ret_conv;
11708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11709 LDKDirectionalChannelInfo o_conv;
11710 o_conv.inner = (void*)(o & (~1));
11711 o_conv.is_owned = (o & 1) || (o == 0);
11712 o_conv = DirectionalChannelInfo_clone(&o_conv);
11713 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11714 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
11715 return (uint64_t)ret_conv;
11718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11719 LDKDecodeError e_conv;
11720 e_conv.inner = (void*)(e & (~1));
11721 e_conv.is_owned = (e & 1) || (e == 0);
11722 e_conv = DecodeError_clone(&e_conv);
11723 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11724 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
11725 return (uint64_t)ret_conv;
11728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11729 if ((_res & 1) != 0) return;
11730 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11732 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
11735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11736 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
11737 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11738 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
11739 return (uint64_t)ret_conv;
11742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11743 LDKChannelInfo o_conv;
11744 o_conv.inner = (void*)(o & (~1));
11745 o_conv.is_owned = (o & 1) || (o == 0);
11746 o_conv = ChannelInfo_clone(&o_conv);
11747 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11748 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
11749 return (uint64_t)ret_conv;
11752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11753 LDKDecodeError e_conv;
11754 e_conv.inner = (void*)(e & (~1));
11755 e_conv.is_owned = (e & 1) || (e == 0);
11756 e_conv = DecodeError_clone(&e_conv);
11757 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11758 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
11759 return (uint64_t)ret_conv;
11762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11763 if ((_res & 1) != 0) return;
11764 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11766 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
11769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11770 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
11771 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11772 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
11773 return (uint64_t)ret_conv;
11776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11777 LDKRoutingFees o_conv;
11778 o_conv.inner = (void*)(o & (~1));
11779 o_conv.is_owned = (o & 1) || (o == 0);
11780 o_conv = RoutingFees_clone(&o_conv);
11781 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11782 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
11783 return (uint64_t)ret_conv;
11786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11787 LDKDecodeError e_conv;
11788 e_conv.inner = (void*)(e & (~1));
11789 e_conv.is_owned = (e & 1) || (e == 0);
11790 e_conv = DecodeError_clone(&e_conv);
11791 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11792 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
11793 return (uint64_t)ret_conv;
11796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11797 if ((_res & 1) != 0) return;
11798 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11800 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
11803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11804 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
11805 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11806 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
11807 return (uint64_t)ret_conv;
11810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11811 LDKNodeAnnouncementInfo o_conv;
11812 o_conv.inner = (void*)(o & (~1));
11813 o_conv.is_owned = (o & 1) || (o == 0);
11814 o_conv = NodeAnnouncementInfo_clone(&o_conv);
11815 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11816 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
11817 return (uint64_t)ret_conv;
11820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11821 LDKDecodeError e_conv;
11822 e_conv.inner = (void*)(e & (~1));
11823 e_conv.is_owned = (e & 1) || (e == 0);
11824 e_conv = DecodeError_clone(&e_conv);
11825 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11826 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
11827 return (uint64_t)ret_conv;
11830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11831 if ((_res & 1) != 0) return;
11832 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11834 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
11837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11838 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
11839 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11840 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
11841 return (uint64_t)ret_conv;
11844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11845 LDKCVec_u64Z _res_constr;
11846 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11847 if (_res_constr.datalen > 0)
11848 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11850 _res_constr.data = NULL;
11851 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11852 for (size_t g = 0; g < _res_constr.datalen; g++) {
11853 int64_t _res_conv_6 = _res_vals[g];
11854 _res_constr.data[g] = _res_conv_6;
11856 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11857 CVec_u64Z_free(_res_constr);
11860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11861 LDKNodeInfo o_conv;
11862 o_conv.inner = (void*)(o & (~1));
11863 o_conv.is_owned = (o & 1) || (o == 0);
11864 o_conv = NodeInfo_clone(&o_conv);
11865 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11866 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
11867 return (uint64_t)ret_conv;
11870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11871 LDKDecodeError e_conv;
11872 e_conv.inner = (void*)(e & (~1));
11873 e_conv.is_owned = (e & 1) || (e == 0);
11874 e_conv = DecodeError_clone(&e_conv);
11875 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11876 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
11877 return (uint64_t)ret_conv;
11880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11881 if ((_res & 1) != 0) return;
11882 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11884 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
11887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11888 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
11889 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11890 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
11891 return (uint64_t)ret_conv;
11894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11895 LDKNetworkGraph o_conv;
11896 o_conv.inner = (void*)(o & (~1));
11897 o_conv.is_owned = (o & 1) || (o == 0);
11898 o_conv = NetworkGraph_clone(&o_conv);
11899 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11900 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
11901 return (uint64_t)ret_conv;
11904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11905 LDKDecodeError e_conv;
11906 e_conv.inner = (void*)(e & (~1));
11907 e_conv.is_owned = (e & 1) || (e == 0);
11908 e_conv = DecodeError_clone(&e_conv);
11909 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11910 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
11911 return (uint64_t)ret_conv;
11914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11915 if ((_res & 1) != 0) return;
11916 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
11918 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
11921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11922 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
11923 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11924 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
11925 return (uint64_t)ret_conv;
11928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
11929 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11930 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11931 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
11932 return (uint64_t)ret_conv;
11935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
11936 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11937 *ret_conv = CResult_NetAddressu8Z_err(e);
11938 return (uint64_t)ret_conv;
11941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11942 if ((_res & 1) != 0) return;
11943 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
11945 CResult_NetAddressu8Z_free(_res_conv);
11948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11949 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
11950 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11951 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
11952 return (uint64_t)ret_conv;
11955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11956 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
11957 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11958 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
11959 return (uint64_t)ret_conv;
11962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11963 LDKDecodeError e_conv;
11964 e_conv.inner = (void*)(e & (~1));
11965 e_conv.is_owned = (e & 1) || (e == 0);
11966 e_conv = DecodeError_clone(&e_conv);
11967 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11968 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
11969 return (uint64_t)ret_conv;
11972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11973 if ((_res & 1) != 0) return;
11974 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11976 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
11979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11980 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
11981 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11982 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
11983 return (uint64_t)ret_conv;
11986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11987 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11988 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11989 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
11990 return (uint64_t)ret_conv;
11993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11994 LDKDecodeError e_conv;
11995 e_conv.inner = (void*)(e & (~1));
11996 e_conv.is_owned = (e & 1) || (e == 0);
11997 e_conv = DecodeError_clone(&e_conv);
11998 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11999 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
12000 return (uint64_t)ret_conv;
12003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12004 if ((_res & 1) != 0) return;
12005 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
12007 CResult_NetAddressDecodeErrorZ_free(_res_conv);
12010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12011 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
12012 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12013 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
12014 return (uint64_t)ret_conv;
12017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12018 LDKCVec_UpdateAddHTLCZ _res_constr;
12019 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12020 if (_res_constr.datalen > 0)
12021 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12023 _res_constr.data = NULL;
12024 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12025 for (size_t p = 0; p < _res_constr.datalen; p++) {
12026 int64_t _res_conv_15 = _res_vals[p];
12027 LDKUpdateAddHTLC _res_conv_15_conv;
12028 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
12029 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
12030 _res_constr.data[p] = _res_conv_15_conv;
12032 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12033 CVec_UpdateAddHTLCZ_free(_res_constr);
12036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12037 LDKCVec_UpdateFulfillHTLCZ _res_constr;
12038 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12039 if (_res_constr.datalen > 0)
12040 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
12042 _res_constr.data = NULL;
12043 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12044 for (size_t t = 0; t < _res_constr.datalen; t++) {
12045 int64_t _res_conv_19 = _res_vals[t];
12046 LDKUpdateFulfillHTLC _res_conv_19_conv;
12047 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
12048 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
12049 _res_constr.data[t] = _res_conv_19_conv;
12051 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12052 CVec_UpdateFulfillHTLCZ_free(_res_constr);
12055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12056 LDKCVec_UpdateFailHTLCZ _res_constr;
12057 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12058 if (_res_constr.datalen > 0)
12059 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
12061 _res_constr.data = NULL;
12062 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12063 for (size_t q = 0; q < _res_constr.datalen; q++) {
12064 int64_t _res_conv_16 = _res_vals[q];
12065 LDKUpdateFailHTLC _res_conv_16_conv;
12066 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12067 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12068 _res_constr.data[q] = _res_conv_16_conv;
12070 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12071 CVec_UpdateFailHTLCZ_free(_res_constr);
12074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12075 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
12076 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12077 if (_res_constr.datalen > 0)
12078 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
12080 _res_constr.data = NULL;
12081 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12082 for (size_t z = 0; z < _res_constr.datalen; z++) {
12083 int64_t _res_conv_25 = _res_vals[z];
12084 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
12085 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
12086 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
12087 _res_constr.data[z] = _res_conv_25_conv;
12089 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12090 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
12093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12094 LDKAcceptChannel o_conv;
12095 o_conv.inner = (void*)(o & (~1));
12096 o_conv.is_owned = (o & 1) || (o == 0);
12097 o_conv = AcceptChannel_clone(&o_conv);
12098 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12099 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
12100 return (uint64_t)ret_conv;
12103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12104 LDKDecodeError e_conv;
12105 e_conv.inner = (void*)(e & (~1));
12106 e_conv.is_owned = (e & 1) || (e == 0);
12107 e_conv = DecodeError_clone(&e_conv);
12108 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12109 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
12110 return (uint64_t)ret_conv;
12113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12114 if ((_res & 1) != 0) return;
12115 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12117 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
12120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12121 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
12122 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12123 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
12124 return (uint64_t)ret_conv;
12127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12128 LDKAnnouncementSignatures o_conv;
12129 o_conv.inner = (void*)(o & (~1));
12130 o_conv.is_owned = (o & 1) || (o == 0);
12131 o_conv = AnnouncementSignatures_clone(&o_conv);
12132 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12133 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
12134 return (uint64_t)ret_conv;
12137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12138 LDKDecodeError e_conv;
12139 e_conv.inner = (void*)(e & (~1));
12140 e_conv.is_owned = (e & 1) || (e == 0);
12141 e_conv = DecodeError_clone(&e_conv);
12142 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12143 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
12144 return (uint64_t)ret_conv;
12147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12148 if ((_res & 1) != 0) return;
12149 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
12151 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
12154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12155 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
12156 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12157 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
12158 return (uint64_t)ret_conv;
12161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12162 LDKChannelReestablish o_conv;
12163 o_conv.inner = (void*)(o & (~1));
12164 o_conv.is_owned = (o & 1) || (o == 0);
12165 o_conv = ChannelReestablish_clone(&o_conv);
12166 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12167 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
12168 return (uint64_t)ret_conv;
12171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12172 LDKDecodeError e_conv;
12173 e_conv.inner = (void*)(e & (~1));
12174 e_conv.is_owned = (e & 1) || (e == 0);
12175 e_conv = DecodeError_clone(&e_conv);
12176 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12177 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
12178 return (uint64_t)ret_conv;
12181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12182 if ((_res & 1) != 0) return;
12183 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
12185 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
12188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12189 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
12190 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12191 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
12192 return (uint64_t)ret_conv;
12195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12196 LDKClosingSigned o_conv;
12197 o_conv.inner = (void*)(o & (~1));
12198 o_conv.is_owned = (o & 1) || (o == 0);
12199 o_conv = ClosingSigned_clone(&o_conv);
12200 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12201 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
12202 return (uint64_t)ret_conv;
12205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12206 LDKDecodeError e_conv;
12207 e_conv.inner = (void*)(e & (~1));
12208 e_conv.is_owned = (e & 1) || (e == 0);
12209 e_conv = DecodeError_clone(&e_conv);
12210 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12211 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
12212 return (uint64_t)ret_conv;
12215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12216 if ((_res & 1) != 0) return;
12217 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12219 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
12222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12223 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
12224 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12225 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
12226 return (uint64_t)ret_conv;
12229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12230 LDKCommitmentSigned o_conv;
12231 o_conv.inner = (void*)(o & (~1));
12232 o_conv.is_owned = (o & 1) || (o == 0);
12233 o_conv = CommitmentSigned_clone(&o_conv);
12234 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12235 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
12236 return (uint64_t)ret_conv;
12239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12240 LDKDecodeError e_conv;
12241 e_conv.inner = (void*)(e & (~1));
12242 e_conv.is_owned = (e & 1) || (e == 0);
12243 e_conv = DecodeError_clone(&e_conv);
12244 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12245 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
12246 return (uint64_t)ret_conv;
12249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12250 if ((_res & 1) != 0) return;
12251 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12253 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
12256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12257 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
12258 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12259 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
12260 return (uint64_t)ret_conv;
12263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12264 LDKFundingCreated o_conv;
12265 o_conv.inner = (void*)(o & (~1));
12266 o_conv.is_owned = (o & 1) || (o == 0);
12267 o_conv = FundingCreated_clone(&o_conv);
12268 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12269 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
12270 return (uint64_t)ret_conv;
12273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12274 LDKDecodeError e_conv;
12275 e_conv.inner = (void*)(e & (~1));
12276 e_conv.is_owned = (e & 1) || (e == 0);
12277 e_conv = DecodeError_clone(&e_conv);
12278 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12279 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
12280 return (uint64_t)ret_conv;
12283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12284 if ((_res & 1) != 0) return;
12285 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12287 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
12290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12291 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
12292 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12293 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
12294 return (uint64_t)ret_conv;
12297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12298 LDKFundingSigned o_conv;
12299 o_conv.inner = (void*)(o & (~1));
12300 o_conv.is_owned = (o & 1) || (o == 0);
12301 o_conv = FundingSigned_clone(&o_conv);
12302 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12303 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
12304 return (uint64_t)ret_conv;
12307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12308 LDKDecodeError e_conv;
12309 e_conv.inner = (void*)(e & (~1));
12310 e_conv.is_owned = (e & 1) || (e == 0);
12311 e_conv = DecodeError_clone(&e_conv);
12312 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12313 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
12314 return (uint64_t)ret_conv;
12317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12318 if ((_res & 1) != 0) return;
12319 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12321 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
12324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12325 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
12326 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12327 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
12328 return (uint64_t)ret_conv;
12331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12332 LDKFundingLocked o_conv;
12333 o_conv.inner = (void*)(o & (~1));
12334 o_conv.is_owned = (o & 1) || (o == 0);
12335 o_conv = FundingLocked_clone(&o_conv);
12336 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12337 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
12338 return (uint64_t)ret_conv;
12341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12342 LDKDecodeError e_conv;
12343 e_conv.inner = (void*)(e & (~1));
12344 e_conv.is_owned = (e & 1) || (e == 0);
12345 e_conv = DecodeError_clone(&e_conv);
12346 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12347 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
12348 return (uint64_t)ret_conv;
12351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12352 if ((_res & 1) != 0) return;
12353 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12355 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
12358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12359 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
12360 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12361 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
12362 return (uint64_t)ret_conv;
12365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12367 o_conv.inner = (void*)(o & (~1));
12368 o_conv.is_owned = (o & 1) || (o == 0);
12369 o_conv = Init_clone(&o_conv);
12370 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12371 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
12372 return (uint64_t)ret_conv;
12375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12376 LDKDecodeError e_conv;
12377 e_conv.inner = (void*)(e & (~1));
12378 e_conv.is_owned = (e & 1) || (e == 0);
12379 e_conv = DecodeError_clone(&e_conv);
12380 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12381 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
12382 return (uint64_t)ret_conv;
12385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12386 if ((_res & 1) != 0) return;
12387 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
12389 CResult_InitDecodeErrorZ_free(_res_conv);
12392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12393 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
12394 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12395 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
12396 return (uint64_t)ret_conv;
12399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12400 LDKOpenChannel o_conv;
12401 o_conv.inner = (void*)(o & (~1));
12402 o_conv.is_owned = (o & 1) || (o == 0);
12403 o_conv = OpenChannel_clone(&o_conv);
12404 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12405 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
12406 return (uint64_t)ret_conv;
12409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12410 LDKDecodeError e_conv;
12411 e_conv.inner = (void*)(e & (~1));
12412 e_conv.is_owned = (e & 1) || (e == 0);
12413 e_conv = DecodeError_clone(&e_conv);
12414 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12415 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
12416 return (uint64_t)ret_conv;
12419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12420 if ((_res & 1) != 0) return;
12421 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12423 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
12426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12427 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
12428 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12429 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
12430 return (uint64_t)ret_conv;
12433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12434 LDKRevokeAndACK o_conv;
12435 o_conv.inner = (void*)(o & (~1));
12436 o_conv.is_owned = (o & 1) || (o == 0);
12437 o_conv = RevokeAndACK_clone(&o_conv);
12438 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12439 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
12440 return (uint64_t)ret_conv;
12443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12444 LDKDecodeError e_conv;
12445 e_conv.inner = (void*)(e & (~1));
12446 e_conv.is_owned = (e & 1) || (e == 0);
12447 e_conv = DecodeError_clone(&e_conv);
12448 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12449 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
12450 return (uint64_t)ret_conv;
12453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12454 if ((_res & 1) != 0) return;
12455 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
12457 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
12460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12461 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
12462 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12463 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
12464 return (uint64_t)ret_conv;
12467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12468 LDKShutdown o_conv;
12469 o_conv.inner = (void*)(o & (~1));
12470 o_conv.is_owned = (o & 1) || (o == 0);
12471 o_conv = Shutdown_clone(&o_conv);
12472 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12473 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
12474 return (uint64_t)ret_conv;
12477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12478 LDKDecodeError e_conv;
12479 e_conv.inner = (void*)(e & (~1));
12480 e_conv.is_owned = (e & 1) || (e == 0);
12481 e_conv = DecodeError_clone(&e_conv);
12482 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12483 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
12484 return (uint64_t)ret_conv;
12487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12488 if ((_res & 1) != 0) return;
12489 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
12491 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12495 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12496 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12497 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12498 return (uint64_t)ret_conv;
12501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12502 LDKUpdateFailHTLC o_conv;
12503 o_conv.inner = (void*)(o & (~1));
12504 o_conv.is_owned = (o & 1) || (o == 0);
12505 o_conv = UpdateFailHTLC_clone(&o_conv);
12506 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12507 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12508 return (uint64_t)ret_conv;
12511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12512 LDKDecodeError e_conv;
12513 e_conv.inner = (void*)(e & (~1));
12514 e_conv.is_owned = (e & 1) || (e == 0);
12515 e_conv = DecodeError_clone(&e_conv);
12516 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12517 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12518 return (uint64_t)ret_conv;
12521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12522 if ((_res & 1) != 0) return;
12523 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12525 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12529 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12530 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12531 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12532 return (uint64_t)ret_conv;
12535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12536 LDKUpdateFailMalformedHTLC o_conv;
12537 o_conv.inner = (void*)(o & (~1));
12538 o_conv.is_owned = (o & 1) || (o == 0);
12539 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12540 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12541 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12542 return (uint64_t)ret_conv;
12545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12546 LDKDecodeError e_conv;
12547 e_conv.inner = (void*)(e & (~1));
12548 e_conv.is_owned = (e & 1) || (e == 0);
12549 e_conv = DecodeError_clone(&e_conv);
12550 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12551 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12552 return (uint64_t)ret_conv;
12555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12556 if ((_res & 1) != 0) return;
12557 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12559 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12563 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12564 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12565 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12566 return (uint64_t)ret_conv;
12569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12570 LDKUpdateFee o_conv;
12571 o_conv.inner = (void*)(o & (~1));
12572 o_conv.is_owned = (o & 1) || (o == 0);
12573 o_conv = UpdateFee_clone(&o_conv);
12574 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12575 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12576 return (uint64_t)ret_conv;
12579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12580 LDKDecodeError e_conv;
12581 e_conv.inner = (void*)(e & (~1));
12582 e_conv.is_owned = (e & 1) || (e == 0);
12583 e_conv = DecodeError_clone(&e_conv);
12584 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12585 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12586 return (uint64_t)ret_conv;
12589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12590 if ((_res & 1) != 0) return;
12591 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12593 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12597 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12598 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12599 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12600 return (uint64_t)ret_conv;
12603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12604 LDKUpdateFulfillHTLC o_conv;
12605 o_conv.inner = (void*)(o & (~1));
12606 o_conv.is_owned = (o & 1) || (o == 0);
12607 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12608 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12609 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12610 return (uint64_t)ret_conv;
12613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12614 LDKDecodeError e_conv;
12615 e_conv.inner = (void*)(e & (~1));
12616 e_conv.is_owned = (e & 1) || (e == 0);
12617 e_conv = DecodeError_clone(&e_conv);
12618 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12619 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12620 return (uint64_t)ret_conv;
12623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12624 if ((_res & 1) != 0) return;
12625 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12627 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12631 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12632 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12633 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
12634 return (uint64_t)ret_conv;
12637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12638 LDKUpdateAddHTLC o_conv;
12639 o_conv.inner = (void*)(o & (~1));
12640 o_conv.is_owned = (o & 1) || (o == 0);
12641 o_conv = UpdateAddHTLC_clone(&o_conv);
12642 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12643 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
12644 return (uint64_t)ret_conv;
12647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12648 LDKDecodeError e_conv;
12649 e_conv.inner = (void*)(e & (~1));
12650 e_conv.is_owned = (e & 1) || (e == 0);
12651 e_conv = DecodeError_clone(&e_conv);
12652 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12653 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
12654 return (uint64_t)ret_conv;
12657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12658 if ((_res & 1) != 0) return;
12659 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12661 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
12664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12665 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
12666 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12667 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
12668 return (uint64_t)ret_conv;
12671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12673 o_conv.inner = (void*)(o & (~1));
12674 o_conv.is_owned = (o & 1) || (o == 0);
12675 o_conv = Ping_clone(&o_conv);
12676 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12677 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
12678 return (uint64_t)ret_conv;
12681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12682 LDKDecodeError e_conv;
12683 e_conv.inner = (void*)(e & (~1));
12684 e_conv.is_owned = (e & 1) || (e == 0);
12685 e_conv = DecodeError_clone(&e_conv);
12686 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12687 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
12688 return (uint64_t)ret_conv;
12691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12692 if ((_res & 1) != 0) return;
12693 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
12695 CResult_PingDecodeErrorZ_free(_res_conv);
12698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12699 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
12700 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12701 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
12702 return (uint64_t)ret_conv;
12705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12707 o_conv.inner = (void*)(o & (~1));
12708 o_conv.is_owned = (o & 1) || (o == 0);
12709 o_conv = Pong_clone(&o_conv);
12710 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12711 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
12712 return (uint64_t)ret_conv;
12715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12716 LDKDecodeError e_conv;
12717 e_conv.inner = (void*)(e & (~1));
12718 e_conv.is_owned = (e & 1) || (e == 0);
12719 e_conv = DecodeError_clone(&e_conv);
12720 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12721 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
12722 return (uint64_t)ret_conv;
12725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12726 if ((_res & 1) != 0) return;
12727 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
12729 CResult_PongDecodeErrorZ_free(_res_conv);
12732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12733 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
12734 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12735 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
12736 return (uint64_t)ret_conv;
12739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12740 LDKUnsignedChannelAnnouncement o_conv;
12741 o_conv.inner = (void*)(o & (~1));
12742 o_conv.is_owned = (o & 1) || (o == 0);
12743 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
12744 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12745 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
12746 return (uint64_t)ret_conv;
12749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12750 LDKDecodeError e_conv;
12751 e_conv.inner = (void*)(e & (~1));
12752 e_conv.is_owned = (e & 1) || (e == 0);
12753 e_conv = DecodeError_clone(&e_conv);
12754 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12755 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
12756 return (uint64_t)ret_conv;
12759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12760 if ((_res & 1) != 0) return;
12761 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12763 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
12766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12767 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12768 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12769 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12770 return (uint64_t)ret_conv;
12773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12774 LDKChannelAnnouncement o_conv;
12775 o_conv.inner = (void*)(o & (~1));
12776 o_conv.is_owned = (o & 1) || (o == 0);
12777 o_conv = ChannelAnnouncement_clone(&o_conv);
12778 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12779 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
12780 return (uint64_t)ret_conv;
12783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12784 LDKDecodeError e_conv;
12785 e_conv.inner = (void*)(e & (~1));
12786 e_conv.is_owned = (e & 1) || (e == 0);
12787 e_conv = DecodeError_clone(&e_conv);
12788 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12789 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
12790 return (uint64_t)ret_conv;
12793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12794 if ((_res & 1) != 0) return;
12795 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12797 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
12800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12801 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12802 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12803 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12804 return (uint64_t)ret_conv;
12807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12808 LDKUnsignedChannelUpdate o_conv;
12809 o_conv.inner = (void*)(o & (~1));
12810 o_conv.is_owned = (o & 1) || (o == 0);
12811 o_conv = UnsignedChannelUpdate_clone(&o_conv);
12812 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12813 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
12814 return (uint64_t)ret_conv;
12817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12818 LDKDecodeError e_conv;
12819 e_conv.inner = (void*)(e & (~1));
12820 e_conv.is_owned = (e & 1) || (e == 0);
12821 e_conv = DecodeError_clone(&e_conv);
12822 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12823 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
12824 return (uint64_t)ret_conv;
12827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12828 if ((_res & 1) != 0) return;
12829 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12831 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
12834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12835 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
12836 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12837 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
12838 return (uint64_t)ret_conv;
12841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12842 LDKChannelUpdate o_conv;
12843 o_conv.inner = (void*)(o & (~1));
12844 o_conv.is_owned = (o & 1) || (o == 0);
12845 o_conv = ChannelUpdate_clone(&o_conv);
12846 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12847 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
12848 return (uint64_t)ret_conv;
12851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12852 LDKDecodeError e_conv;
12853 e_conv.inner = (void*)(e & (~1));
12854 e_conv.is_owned = (e & 1) || (e == 0);
12855 e_conv = DecodeError_clone(&e_conv);
12856 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12857 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
12858 return (uint64_t)ret_conv;
12861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12862 if ((_res & 1) != 0) return;
12863 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12865 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
12868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12869 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
12870 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12871 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
12872 return (uint64_t)ret_conv;
12875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12876 LDKErrorMessage o_conv;
12877 o_conv.inner = (void*)(o & (~1));
12878 o_conv.is_owned = (o & 1) || (o == 0);
12879 o_conv = ErrorMessage_clone(&o_conv);
12880 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12881 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
12882 return (uint64_t)ret_conv;
12885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12886 LDKDecodeError e_conv;
12887 e_conv.inner = (void*)(e & (~1));
12888 e_conv.is_owned = (e & 1) || (e == 0);
12889 e_conv = DecodeError_clone(&e_conv);
12890 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12891 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
12892 return (uint64_t)ret_conv;
12895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12896 if ((_res & 1) != 0) return;
12897 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
12899 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
12902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12903 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
12904 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12905 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
12906 return (uint64_t)ret_conv;
12909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12910 LDKUnsignedNodeAnnouncement o_conv;
12911 o_conv.inner = (void*)(o & (~1));
12912 o_conv.is_owned = (o & 1) || (o == 0);
12913 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
12914 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12915 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
12916 return (uint64_t)ret_conv;
12919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12920 LDKDecodeError e_conv;
12921 e_conv.inner = (void*)(e & (~1));
12922 e_conv.is_owned = (e & 1) || (e == 0);
12923 e_conv = DecodeError_clone(&e_conv);
12924 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12925 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
12926 return (uint64_t)ret_conv;
12929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12930 if ((_res & 1) != 0) return;
12931 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12933 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
12936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12937 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
12938 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12939 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
12940 return (uint64_t)ret_conv;
12943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12944 LDKNodeAnnouncement o_conv;
12945 o_conv.inner = (void*)(o & (~1));
12946 o_conv.is_owned = (o & 1) || (o == 0);
12947 o_conv = NodeAnnouncement_clone(&o_conv);
12948 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12949 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
12950 return (uint64_t)ret_conv;
12953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12954 LDKDecodeError e_conv;
12955 e_conv.inner = (void*)(e & (~1));
12956 e_conv.is_owned = (e & 1) || (e == 0);
12957 e_conv = DecodeError_clone(&e_conv);
12958 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12959 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
12960 return (uint64_t)ret_conv;
12963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12964 if ((_res & 1) != 0) return;
12965 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12967 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
12970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12971 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
12972 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12973 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
12974 return (uint64_t)ret_conv;
12977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12978 LDKQueryShortChannelIds o_conv;
12979 o_conv.inner = (void*)(o & (~1));
12980 o_conv.is_owned = (o & 1) || (o == 0);
12981 o_conv = QueryShortChannelIds_clone(&o_conv);
12982 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12983 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
12984 return (uint64_t)ret_conv;
12987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12988 LDKDecodeError e_conv;
12989 e_conv.inner = (void*)(e & (~1));
12990 e_conv.is_owned = (e & 1) || (e == 0);
12991 e_conv = DecodeError_clone(&e_conv);
12992 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12993 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
12994 return (uint64_t)ret_conv;
12997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12998 if ((_res & 1) != 0) return;
12999 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
13001 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
13004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13005 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
13006 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13007 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
13008 return (uint64_t)ret_conv;
13011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13012 LDKReplyShortChannelIdsEnd o_conv;
13013 o_conv.inner = (void*)(o & (~1));
13014 o_conv.is_owned = (o & 1) || (o == 0);
13015 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
13016 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13017 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
13018 return (uint64_t)ret_conv;
13021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13022 LDKDecodeError e_conv;
13023 e_conv.inner = (void*)(e & (~1));
13024 e_conv.is_owned = (e & 1) || (e == 0);
13025 e_conv = DecodeError_clone(&e_conv);
13026 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13027 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
13028 return (uint64_t)ret_conv;
13031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13032 if ((_res & 1) != 0) return;
13033 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
13035 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
13038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13039 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
13040 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13041 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
13042 return (uint64_t)ret_conv;
13045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13046 LDKQueryChannelRange o_conv;
13047 o_conv.inner = (void*)(o & (~1));
13048 o_conv.is_owned = (o & 1) || (o == 0);
13049 o_conv = QueryChannelRange_clone(&o_conv);
13050 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13051 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
13052 return (uint64_t)ret_conv;
13055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13056 LDKDecodeError e_conv;
13057 e_conv.inner = (void*)(e & (~1));
13058 e_conv.is_owned = (e & 1) || (e == 0);
13059 e_conv = DecodeError_clone(&e_conv);
13060 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13061 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
13062 return (uint64_t)ret_conv;
13065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13066 if ((_res & 1) != 0) return;
13067 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13069 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
13072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13073 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
13074 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13075 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
13076 return (uint64_t)ret_conv;
13079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13080 LDKReplyChannelRange o_conv;
13081 o_conv.inner = (void*)(o & (~1));
13082 o_conv.is_owned = (o & 1) || (o == 0);
13083 o_conv = ReplyChannelRange_clone(&o_conv);
13084 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13085 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
13086 return (uint64_t)ret_conv;
13089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13090 LDKDecodeError e_conv;
13091 e_conv.inner = (void*)(e & (~1));
13092 e_conv.is_owned = (e & 1) || (e == 0);
13093 e_conv = DecodeError_clone(&e_conv);
13094 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13095 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
13096 return (uint64_t)ret_conv;
13099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13100 if ((_res & 1) != 0) return;
13101 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13103 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
13106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13107 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
13108 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13109 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
13110 return (uint64_t)ret_conv;
13113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13114 LDKGossipTimestampFilter o_conv;
13115 o_conv.inner = (void*)(o & (~1));
13116 o_conv.is_owned = (o & 1) || (o == 0);
13117 o_conv = GossipTimestampFilter_clone(&o_conv);
13118 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13119 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
13120 return (uint64_t)ret_conv;
13123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13124 LDKDecodeError e_conv;
13125 e_conv.inner = (void*)(e & (~1));
13126 e_conv.is_owned = (e & 1) || (e == 0);
13127 e_conv = DecodeError_clone(&e_conv);
13128 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13129 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
13130 return (uint64_t)ret_conv;
13133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13134 if ((_res & 1) != 0) return;
13135 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
13137 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
13140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13141 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
13142 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13143 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
13144 return (uint64_t)ret_conv;
13147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13149 o_conv.inner = (void*)(o & (~1));
13150 o_conv.is_owned = (o & 1) || (o == 0);
13151 o_conv = Invoice_clone(&o_conv);
13152 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13153 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
13154 return (uint64_t)ret_conv;
13157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13158 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
13159 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13160 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
13161 return (uint64_t)ret_conv;
13164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13165 if ((_res & 1) != 0) return;
13166 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
13168 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
13171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13172 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
13173 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13174 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
13175 return (uint64_t)ret_conv;
13178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13179 if ((this_ptr & 1) != 0) return;
13180 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
13181 FREE((void*)this_ptr);
13182 Event_free(this_ptr_conv);
13185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13186 LDKEvent* orig_conv = (LDKEvent*)orig;
13187 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13188 *ret_copy = Event_clone(orig_conv);
13189 uint64_t ret_ref = (uint64_t)ret_copy;
13193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
13194 LDKEvent* obj_conv = (LDKEvent*)obj;
13195 LDKCVec_u8Z ret_var = Event_write(obj_conv);
13196 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13197 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13198 CVec_u8Z_free(ret_var);
13202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13203 if ((this_ptr & 1) != 0) return;
13204 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
13205 FREE((void*)this_ptr);
13206 MessageSendEvent_free(this_ptr_conv);
13209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13210 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
13211 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13212 *ret_copy = MessageSendEvent_clone(orig_conv);
13213 uint64_t ret_ref = (uint64_t)ret_copy;
13217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13218 if ((this_ptr & 1) != 0) return;
13219 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
13220 FREE((void*)this_ptr);
13221 MessageSendEventsProvider_free(this_ptr_conv);
13224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13225 if ((this_ptr & 1) != 0) return;
13226 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
13227 FREE((void*)this_ptr);
13228 EventsProvider_free(this_ptr_conv);
13231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13232 if ((this_ptr & 1) != 0) return;
13233 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
13234 FREE((void*)this_ptr);
13235 EventHandler_free(this_ptr_conv);
13238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13239 if ((this_ptr & 1) != 0) return;
13240 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
13241 FREE((void*)this_ptr);
13242 APIError_free(this_ptr_conv);
13245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13246 LDKAPIError* orig_conv = (LDKAPIError*)orig;
13247 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13248 *ret_copy = APIError_clone(orig_conv);
13249 uint64_t ret_ref = (uint64_t)ret_copy;
13253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
13254 LDKu8slice msg_ref;
13255 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
13256 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
13257 LDKSecretKey sk_ref;
13258 CHECK((*env)->GetArrayLength(env, sk) == 32);
13259 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_ref.bytes);
13260 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
13261 *ret_conv = sign(msg_ref, sk_ref);
13262 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
13263 return (uint64_t)ret_conv;
13266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
13267 LDKu8slice msg_ref;
13268 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
13269 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
13270 LDKStr sig_conv = java_to_owned_str(env, sig);
13271 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13272 *ret_conv = recover_pk(msg_ref, sig_conv);
13273 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
13274 return (uint64_t)ret_conv;
13277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
13278 LDKu8slice msg_ref;
13279 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
13280 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
13281 LDKStr sig_conv = java_to_owned_str(env, sig);
13282 LDKPublicKey pk_ref;
13283 CHECK((*env)->GetArrayLength(env, pk) == 33);
13284 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
13285 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
13286 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
13290 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13291 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
13292 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
13296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
13297 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
13298 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
13299 jboolean ret_val = Level_eq(a_conv, b_conv);
13303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
13304 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
13305 int64_t ret_val = Level_hash(o_conv);
13309 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
13310 jclass ret_conv = LDKLevel_to_java(env, Level_max());
13314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13315 if ((this_ptr & 1) != 0) return;
13316 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
13317 FREE((void*)this_ptr);
13318 Logger_free(this_ptr_conv);
13321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13322 LDKChannelHandshakeConfig this_obj_conv;
13323 this_obj_conv.inner = (void*)(this_obj & (~1));
13324 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13325 ChannelHandshakeConfig_free(this_obj_conv);
13328 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13329 LDKChannelHandshakeConfig this_ptr_conv;
13330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13331 this_ptr_conv.is_owned = false;
13332 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
13336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13337 LDKChannelHandshakeConfig this_ptr_conv;
13338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13339 this_ptr_conv.is_owned = false;
13340 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
13343 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13344 LDKChannelHandshakeConfig this_ptr_conv;
13345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13346 this_ptr_conv.is_owned = false;
13347 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
13351 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) {
13352 LDKChannelHandshakeConfig this_ptr_conv;
13353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13354 this_ptr_conv.is_owned = false;
13355 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
13358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13359 LDKChannelHandshakeConfig this_ptr_conv;
13360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13361 this_ptr_conv.is_owned = false;
13362 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
13366 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) {
13367 LDKChannelHandshakeConfig this_ptr_conv;
13368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13369 this_ptr_conv.is_owned = false;
13370 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
13373 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) {
13374 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
13375 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13376 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13377 uint64_t ret_ref = (uint64_t)ret_var.inner;
13378 if (ret_var.is_owned) {
13384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13385 LDKChannelHandshakeConfig orig_conv;
13386 orig_conv.inner = (void*)(orig & (~1));
13387 orig_conv.is_owned = false;
13388 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
13389 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13390 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13391 uint64_t ret_ref = (uint64_t)ret_var.inner;
13392 if (ret_var.is_owned) {
13398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
13399 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
13400 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13401 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13402 uint64_t ret_ref = (uint64_t)ret_var.inner;
13403 if (ret_var.is_owned) {
13409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13410 LDKChannelHandshakeLimits this_obj_conv;
13411 this_obj_conv.inner = (void*)(this_obj & (~1));
13412 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13413 ChannelHandshakeLimits_free(this_obj_conv);
13416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13417 LDKChannelHandshakeLimits this_ptr_conv;
13418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13419 this_ptr_conv.is_owned = false;
13420 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
13424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13425 LDKChannelHandshakeLimits this_ptr_conv;
13426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13427 this_ptr_conv.is_owned = false;
13428 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
13431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13432 LDKChannelHandshakeLimits this_ptr_conv;
13433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13434 this_ptr_conv.is_owned = false;
13435 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
13439 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) {
13440 LDKChannelHandshakeLimits this_ptr_conv;
13441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13442 this_ptr_conv.is_owned = false;
13443 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
13446 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) {
13447 LDKChannelHandshakeLimits this_ptr_conv;
13448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13449 this_ptr_conv.is_owned = false;
13450 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
13454 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) {
13455 LDKChannelHandshakeLimits this_ptr_conv;
13456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13457 this_ptr_conv.is_owned = false;
13458 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13462 LDKChannelHandshakeLimits this_ptr_conv;
13463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13464 this_ptr_conv.is_owned = false;
13465 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
13469 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) {
13470 LDKChannelHandshakeLimits this_ptr_conv;
13471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13472 this_ptr_conv.is_owned = false;
13473 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
13476 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13477 LDKChannelHandshakeLimits this_ptr_conv;
13478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13479 this_ptr_conv.is_owned = false;
13480 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
13484 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) {
13485 LDKChannelHandshakeLimits this_ptr_conv;
13486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13487 this_ptr_conv.is_owned = false;
13488 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
13491 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13492 LDKChannelHandshakeLimits this_ptr_conv;
13493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13494 this_ptr_conv.is_owned = false;
13495 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
13499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13500 LDKChannelHandshakeLimits this_ptr_conv;
13501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13502 this_ptr_conv.is_owned = false;
13503 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
13506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
13507 LDKChannelHandshakeLimits this_ptr_conv;
13508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13509 this_ptr_conv.is_owned = false;
13510 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
13514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13515 LDKChannelHandshakeLimits this_ptr_conv;
13516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13517 this_ptr_conv.is_owned = false;
13518 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
13521 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13522 LDKChannelHandshakeLimits this_ptr_conv;
13523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13524 this_ptr_conv.is_owned = false;
13525 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
13529 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) {
13530 LDKChannelHandshakeLimits this_ptr_conv;
13531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13532 this_ptr_conv.is_owned = false;
13533 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
13536 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) {
13537 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);
13538 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13539 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13540 uint64_t ret_ref = (uint64_t)ret_var.inner;
13541 if (ret_var.is_owned) {
13547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13548 LDKChannelHandshakeLimits orig_conv;
13549 orig_conv.inner = (void*)(orig & (~1));
13550 orig_conv.is_owned = false;
13551 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
13552 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13553 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13554 uint64_t ret_ref = (uint64_t)ret_var.inner;
13555 if (ret_var.is_owned) {
13561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
13562 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
13563 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13564 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13565 uint64_t ret_ref = (uint64_t)ret_var.inner;
13566 if (ret_var.is_owned) {
13572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13573 LDKChannelConfig this_obj_conv;
13574 this_obj_conv.inner = (void*)(this_obj & (~1));
13575 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13576 ChannelConfig_free(this_obj_conv);
13579 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
13580 LDKChannelConfig this_ptr_conv;
13581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13582 this_ptr_conv.is_owned = false;
13583 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
13587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13588 LDKChannelConfig this_ptr_conv;
13589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13590 this_ptr_conv.is_owned = false;
13591 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
13594 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
13595 LDKChannelConfig this_ptr_conv;
13596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13597 this_ptr_conv.is_owned = false;
13598 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
13602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13603 LDKChannelConfig this_ptr_conv;
13604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13605 this_ptr_conv.is_owned = false;
13606 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
13609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
13610 LDKChannelConfig this_ptr_conv;
13611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13612 this_ptr_conv.is_owned = false;
13613 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
13617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13618 LDKChannelConfig this_ptr_conv;
13619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13620 this_ptr_conv.is_owned = false;
13621 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
13624 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13625 LDKChannelConfig this_ptr_conv;
13626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13627 this_ptr_conv.is_owned = false;
13628 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
13632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13633 LDKChannelConfig this_ptr_conv;
13634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13635 this_ptr_conv.is_owned = false;
13636 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
13639 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) {
13640 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
13641 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13642 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13643 uint64_t ret_ref = (uint64_t)ret_var.inner;
13644 if (ret_var.is_owned) {
13650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13651 LDKChannelConfig orig_conv;
13652 orig_conv.inner = (void*)(orig & (~1));
13653 orig_conv.is_owned = false;
13654 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
13655 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13656 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13657 uint64_t ret_ref = (uint64_t)ret_var.inner;
13658 if (ret_var.is_owned) {
13664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
13665 LDKChannelConfig ret_var = ChannelConfig_default();
13666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13668 uint64_t ret_ref = (uint64_t)ret_var.inner;
13669 if (ret_var.is_owned) {
13675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
13676 LDKChannelConfig obj_conv;
13677 obj_conv.inner = (void*)(obj & (~1));
13678 obj_conv.is_owned = false;
13679 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13680 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13681 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13682 CVec_u8Z_free(ret_var);
13686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13687 LDKu8slice ser_ref;
13688 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13689 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13690 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13691 *ret_conv = ChannelConfig_read(ser_ref);
13692 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13693 return (uint64_t)ret_conv;
13696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13697 LDKUserConfig this_obj_conv;
13698 this_obj_conv.inner = (void*)(this_obj & (~1));
13699 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13700 UserConfig_free(this_obj_conv);
13703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
13704 LDKUserConfig this_ptr_conv;
13705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13706 this_ptr_conv.is_owned = false;
13707 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
13708 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13709 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13710 uint64_t ret_ref = (uint64_t)ret_var.inner;
13711 if (ret_var.is_owned) {
13717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13718 LDKUserConfig this_ptr_conv;
13719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13720 this_ptr_conv.is_owned = false;
13721 LDKChannelHandshakeConfig val_conv;
13722 val_conv.inner = (void*)(val & (~1));
13723 val_conv.is_owned = (val & 1) || (val == 0);
13724 val_conv = ChannelHandshakeConfig_clone(&val_conv);
13725 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
13728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
13729 LDKUserConfig this_ptr_conv;
13730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13731 this_ptr_conv.is_owned = false;
13732 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
13733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13735 uint64_t ret_ref = (uint64_t)ret_var.inner;
13736 if (ret_var.is_owned) {
13742 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) {
13743 LDKUserConfig this_ptr_conv;
13744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13745 this_ptr_conv.is_owned = false;
13746 LDKChannelHandshakeLimits val_conv;
13747 val_conv.inner = (void*)(val & (~1));
13748 val_conv.is_owned = (val & 1) || (val == 0);
13749 val_conv = ChannelHandshakeLimits_clone(&val_conv);
13750 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
13753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
13754 LDKUserConfig this_ptr_conv;
13755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13756 this_ptr_conv.is_owned = false;
13757 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
13758 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13759 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13760 uint64_t ret_ref = (uint64_t)ret_var.inner;
13761 if (ret_var.is_owned) {
13767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13768 LDKUserConfig this_ptr_conv;
13769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13770 this_ptr_conv.is_owned = false;
13771 LDKChannelConfig val_conv;
13772 val_conv.inner = (void*)(val & (~1));
13773 val_conv.is_owned = (val & 1) || (val == 0);
13774 val_conv = ChannelConfig_clone(&val_conv);
13775 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
13778 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) {
13779 LDKChannelHandshakeConfig own_channel_config_arg_conv;
13780 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
13781 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
13782 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
13783 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
13784 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
13785 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
13786 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
13787 LDKChannelConfig channel_options_arg_conv;
13788 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
13789 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
13790 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
13791 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
13792 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13793 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13794 uint64_t ret_ref = (uint64_t)ret_var.inner;
13795 if (ret_var.is_owned) {
13801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13802 LDKUserConfig orig_conv;
13803 orig_conv.inner = (void*)(orig & (~1));
13804 orig_conv.is_owned = false;
13805 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
13806 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13807 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13808 uint64_t ret_ref = (uint64_t)ret_var.inner;
13809 if (ret_var.is_owned) {
13815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
13816 LDKUserConfig ret_var = UserConfig_default();
13817 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13818 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13819 uint64_t ret_ref = (uint64_t)ret_var.inner;
13820 if (ret_var.is_owned) {
13826 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13827 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
13828 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
13832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13833 if ((this_ptr & 1) != 0) return;
13834 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
13835 FREE((void*)this_ptr);
13836 Access_free(this_ptr_conv);
13839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13840 if ((this_ptr & 1) != 0) return;
13841 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
13842 FREE((void*)this_ptr);
13843 Listen_free(this_ptr_conv);
13846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13847 if ((this_ptr & 1) != 0) return;
13848 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
13849 FREE((void*)this_ptr);
13850 Confirm_free(this_ptr_conv);
13853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13854 if ((this_ptr & 1) != 0) return;
13855 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
13856 FREE((void*)this_ptr);
13857 Watch_free(this_ptr_conv);
13860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13861 if ((this_ptr & 1) != 0) return;
13862 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
13863 FREE((void*)this_ptr);
13864 Filter_free(this_ptr_conv);
13867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13868 LDKWatchedOutput this_obj_conv;
13869 this_obj_conv.inner = (void*)(this_obj & (~1));
13870 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13871 WatchedOutput_free(this_obj_conv);
13874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13875 LDKWatchedOutput this_ptr_conv;
13876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13877 this_ptr_conv.is_owned = false;
13878 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13879 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
13883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13884 LDKWatchedOutput this_ptr_conv;
13885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13886 this_ptr_conv.is_owned = false;
13887 LDKThirtyTwoBytes val_ref;
13888 CHECK((*env)->GetArrayLength(env, val) == 32);
13889 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13890 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
13893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13894 LDKWatchedOutput this_ptr_conv;
13895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13896 this_ptr_conv.is_owned = false;
13897 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
13898 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13899 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13900 uint64_t ret_ref = (uint64_t)ret_var.inner;
13901 if (ret_var.is_owned) {
13907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13908 LDKWatchedOutput this_ptr_conv;
13909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13910 this_ptr_conv.is_owned = false;
13911 LDKOutPoint val_conv;
13912 val_conv.inner = (void*)(val & (~1));
13913 val_conv.is_owned = (val & 1) || (val == 0);
13914 val_conv = OutPoint_clone(&val_conv);
13915 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
13918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13919 LDKWatchedOutput this_ptr_conv;
13920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13921 this_ptr_conv.is_owned = false;
13922 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
13923 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13924 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13929 LDKWatchedOutput this_ptr_conv;
13930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13931 this_ptr_conv.is_owned = false;
13932 LDKCVec_u8Z val_ref;
13933 val_ref.datalen = (*env)->GetArrayLength(env, val);
13934 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13935 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
13936 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
13939 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) {
13940 LDKThirtyTwoBytes block_hash_arg_ref;
13941 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
13942 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
13943 LDKOutPoint outpoint_arg_conv;
13944 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13945 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13946 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13947 LDKCVec_u8Z script_pubkey_arg_ref;
13948 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
13949 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13950 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
13951 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
13952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13954 uint64_t ret_ref = (uint64_t)ret_var.inner;
13955 if (ret_var.is_owned) {
13961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13962 LDKWatchedOutput orig_conv;
13963 orig_conv.inner = (void*)(orig & (~1));
13964 orig_conv.is_owned = false;
13965 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
13966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13968 uint64_t ret_ref = (uint64_t)ret_var.inner;
13969 if (ret_var.is_owned) {
13975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
13976 LDKWatchedOutput o_conv;
13977 o_conv.inner = (void*)(o & (~1));
13978 o_conv.is_owned = false;
13979 int64_t ret_val = WatchedOutput_hash(&o_conv);
13983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13984 if ((this_ptr & 1) != 0) return;
13985 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
13986 FREE((void*)this_ptr);
13987 BroadcasterInterface_free(this_ptr_conv);
13990 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13991 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
13992 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
13996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13997 if ((this_ptr & 1) != 0) return;
13998 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
13999 FREE((void*)this_ptr);
14000 FeeEstimator_free(this_ptr_conv);
14003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14004 LDKChainMonitor this_obj_conv;
14005 this_obj_conv.inner = (void*)(this_obj & (~1));
14006 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14007 ChainMonitor_free(this_obj_conv);
14010 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) {
14011 LDKFilter *chain_source_conv_ptr = NULL;
14012 if (chain_source != 0) {
14013 LDKFilter chain_source_conv;
14014 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
14015 if (chain_source_conv.free == LDKFilter_JCalls_free) {
14016 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14017 LDKFilter_JCalls_clone(chain_source_conv.this_arg);
14019 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
14020 *chain_source_conv_ptr = chain_source_conv;
14022 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14023 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14024 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14025 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14027 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14028 if (logger_conv.free == LDKLogger_JCalls_free) {
14029 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14030 LDKLogger_JCalls_clone(logger_conv.this_arg);
14032 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
14033 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
14034 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14035 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
14037 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
14038 if (persister_conv.free == LDKPersist_JCalls_free) {
14039 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14040 LDKPersist_JCalls_clone(persister_conv.this_arg);
14042 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
14043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14045 uint64_t ret_ref = (uint64_t)ret_var.inner;
14046 if (ret_var.is_owned) {
14052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
14053 LDKChainMonitor this_arg_conv;
14054 this_arg_conv.inner = (void*)(this_arg & (~1));
14055 this_arg_conv.is_owned = false;
14056 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
14057 *ret = ChainMonitor_as_Listen(&this_arg_conv);
14058 return (uint64_t)ret;
14061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
14062 LDKChainMonitor this_arg_conv;
14063 this_arg_conv.inner = (void*)(this_arg & (~1));
14064 this_arg_conv.is_owned = false;
14065 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14066 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
14067 return (uint64_t)ret;
14070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
14071 LDKChainMonitor this_arg_conv;
14072 this_arg_conv.inner = (void*)(this_arg & (~1));
14073 this_arg_conv.is_owned = false;
14074 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
14075 *ret = ChainMonitor_as_Watch(&this_arg_conv);
14076 return (uint64_t)ret;
14079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
14080 LDKChainMonitor this_arg_conv;
14081 this_arg_conv.inner = (void*)(this_arg & (~1));
14082 this_arg_conv.is_owned = false;
14083 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14084 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
14085 return (uint64_t)ret;
14088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14089 LDKChannelMonitorUpdate this_obj_conv;
14090 this_obj_conv.inner = (void*)(this_obj & (~1));
14091 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14092 ChannelMonitorUpdate_free(this_obj_conv);
14095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14096 LDKChannelMonitorUpdate this_ptr_conv;
14097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14098 this_ptr_conv.is_owned = false;
14099 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
14103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14104 LDKChannelMonitorUpdate this_ptr_conv;
14105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14106 this_ptr_conv.is_owned = false;
14107 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
14110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14111 LDKChannelMonitorUpdate orig_conv;
14112 orig_conv.inner = (void*)(orig & (~1));
14113 orig_conv.is_owned = false;
14114 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
14115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14117 uint64_t ret_ref = (uint64_t)ret_var.inner;
14118 if (ret_var.is_owned) {
14124 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
14125 LDKChannelMonitorUpdate obj_conv;
14126 obj_conv.inner = (void*)(obj & (~1));
14127 obj_conv.is_owned = false;
14128 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
14129 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14130 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14131 CVec_u8Z_free(ret_var);
14135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14136 LDKu8slice ser_ref;
14137 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14138 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14139 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
14140 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
14141 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14142 return (uint64_t)ret_conv;
14145 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14146 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
14147 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
14151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14152 LDKMonitorUpdateError this_obj_conv;
14153 this_obj_conv.inner = (void*)(this_obj & (~1));
14154 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14155 MonitorUpdateError_free(this_obj_conv);
14158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14159 LDKMonitorUpdateError orig_conv;
14160 orig_conv.inner = (void*)(orig & (~1));
14161 orig_conv.is_owned = false;
14162 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
14163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14165 uint64_t ret_ref = (uint64_t)ret_var.inner;
14166 if (ret_var.is_owned) {
14172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14173 if ((this_ptr & 1) != 0) return;
14174 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
14175 FREE((void*)this_ptr);
14176 MonitorEvent_free(this_ptr_conv);
14179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14180 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
14181 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14182 *ret_copy = MonitorEvent_clone(orig_conv);
14183 uint64_t ret_ref = (uint64_t)ret_copy;
14187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14188 LDKHTLCUpdate this_obj_conv;
14189 this_obj_conv.inner = (void*)(this_obj & (~1));
14190 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14191 HTLCUpdate_free(this_obj_conv);
14194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14195 LDKHTLCUpdate orig_conv;
14196 orig_conv.inner = (void*)(orig & (~1));
14197 orig_conv.is_owned = false;
14198 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
14199 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14200 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14201 uint64_t ret_ref = (uint64_t)ret_var.inner;
14202 if (ret_var.is_owned) {
14208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
14209 LDKHTLCUpdate obj_conv;
14210 obj_conv.inner = (void*)(obj & (~1));
14211 obj_conv.is_owned = false;
14212 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
14213 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14214 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14215 CVec_u8Z_free(ret_var);
14219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14220 LDKu8slice ser_ref;
14221 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14222 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14223 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
14224 *ret_conv = HTLCUpdate_read(ser_ref);
14225 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14226 return (uint64_t)ret_conv;
14229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14230 LDKChannelMonitor this_obj_conv;
14231 this_obj_conv.inner = (void*)(this_obj & (~1));
14232 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14233 ChannelMonitor_free(this_obj_conv);
14236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14237 LDKChannelMonitor orig_conv;
14238 orig_conv.inner = (void*)(orig & (~1));
14239 orig_conv.is_owned = false;
14240 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
14241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14243 uint64_t ret_ref = (uint64_t)ret_var.inner;
14244 if (ret_var.is_owned) {
14250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14251 LDKChannelMonitor obj_conv;
14252 obj_conv.inner = (void*)(obj & (~1));
14253 obj_conv.is_owned = false;
14254 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
14255 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14256 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14257 CVec_u8Z_free(ret_var);
14261 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) {
14262 LDKChannelMonitor this_arg_conv;
14263 this_arg_conv.inner = (void*)(this_arg & (~1));
14264 this_arg_conv.is_owned = false;
14265 LDKChannelMonitorUpdate updates_conv;
14266 updates_conv.inner = (void*)(updates & (~1));
14267 updates_conv.is_owned = false;
14268 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14269 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14270 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14271 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
14272 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
14273 return (uint64_t)ret_conv;
14276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14277 LDKChannelMonitor this_arg_conv;
14278 this_arg_conv.inner = (void*)(this_arg & (~1));
14279 this_arg_conv.is_owned = false;
14280 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
14284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
14285 LDKChannelMonitor this_arg_conv;
14286 this_arg_conv.inner = (void*)(this_arg & (~1));
14287 this_arg_conv.is_owned = false;
14288 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
14289 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
14290 return (uint64_t)ret_ref;
14293 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
14294 LDKChannelMonitor this_arg_conv;
14295 this_arg_conv.inner = (void*)(this_arg & (~1));
14296 this_arg_conv.is_owned = false;
14297 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
14298 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14299 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14300 for (size_t v = 0; v < ret_var.datalen; v++) {
14301 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
14302 *ret_conv_47_ref = ret_var.data[v];
14303 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
14305 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14306 FREE(ret_var.data);
14310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
14311 LDKChannelMonitor this_arg_conv;
14312 this_arg_conv.inner = (void*)(this_arg & (~1));
14313 this_arg_conv.is_owned = false;
14314 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
14315 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
14318 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14319 LDKChannelMonitor this_arg_conv;
14320 this_arg_conv.inner = (void*)(this_arg & (~1));
14321 this_arg_conv.is_owned = false;
14322 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
14323 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14324 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14325 for (size_t o = 0; o < ret_var.datalen; o++) {
14326 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14327 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
14328 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
14329 ret_arr_ptr[o] = ret_conv_14_ref;
14331 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14332 FREE(ret_var.data);
14336 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14337 LDKChannelMonitor this_arg_conv;
14338 this_arg_conv.inner = (void*)(this_arg & (~1));
14339 this_arg_conv.is_owned = false;
14340 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
14341 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14342 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14343 for (size_t h = 0; h < ret_var.datalen; h++) {
14344 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14345 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
14346 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
14347 ret_arr_ptr[h] = ret_conv_7_ref;
14349 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14350 FREE(ret_var.data);
14354 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) {
14355 LDKChannelMonitor this_arg_conv;
14356 this_arg_conv.inner = (void*)(this_arg & (~1));
14357 this_arg_conv.is_owned = false;
14358 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14359 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
14360 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14362 for (size_t i = 0; i < ret_var.datalen; i++) {
14363 LDKTransaction ret_conv_8_var = ret_var.data[i];
14364 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
14365 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
14366 Transaction_free(ret_conv_8_var);
14367 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14369 FREE(ret_var.data);
14373 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) {
14374 LDKChannelMonitor this_arg_conv;
14375 this_arg_conv.inner = (void*)(this_arg & (~1));
14376 this_arg_conv.is_owned = false;
14377 unsigned char header_arr[80];
14378 CHECK((*env)->GetArrayLength(env, header) == 80);
14379 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14380 unsigned char (*header_ref)[80] = &header_arr;
14381 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14382 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14383 if (txdata_constr.datalen > 0)
14384 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14386 txdata_constr.data = NULL;
14387 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14388 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14389 int64_t txdata_conv_24 = txdata_vals[y];
14390 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14391 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14392 txdata_constr.data[y] = txdata_conv_24_conv;
14394 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14395 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14396 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14397 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14398 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14400 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14401 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14402 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14403 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14405 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14406 if (logger_conv.free == LDKLogger_JCalls_free) {
14407 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14408 LDKLogger_JCalls_clone(logger_conv.this_arg);
14410 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);
14411 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14412 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14413 for (size_t u = 0; u < ret_var.datalen; u++) {
14414 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14415 *ret_conv_46_ref = ret_var.data[u];
14416 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14418 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14419 FREE(ret_var.data);
14423 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) {
14424 LDKChannelMonitor this_arg_conv;
14425 this_arg_conv.inner = (void*)(this_arg & (~1));
14426 this_arg_conv.is_owned = false;
14427 unsigned char header_arr[80];
14428 CHECK((*env)->GetArrayLength(env, header) == 80);
14429 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14430 unsigned char (*header_ref)[80] = &header_arr;
14431 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14432 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14433 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14434 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14436 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14437 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14438 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14439 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14441 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14442 if (logger_conv.free == LDKLogger_JCalls_free) {
14443 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14444 LDKLogger_JCalls_clone(logger_conv.this_arg);
14446 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14449 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) {
14450 LDKChannelMonitor this_arg_conv;
14451 this_arg_conv.inner = (void*)(this_arg & (~1));
14452 this_arg_conv.is_owned = false;
14453 unsigned char header_arr[80];
14454 CHECK((*env)->GetArrayLength(env, header) == 80);
14455 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14456 unsigned char (*header_ref)[80] = &header_arr;
14457 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14458 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14459 if (txdata_constr.datalen > 0)
14460 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14462 txdata_constr.data = NULL;
14463 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14464 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14465 int64_t txdata_conv_24 = txdata_vals[y];
14466 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14467 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14468 txdata_constr.data[y] = txdata_conv_24_conv;
14470 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14471 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14472 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14473 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14474 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14476 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14477 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14478 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14479 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14481 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14482 if (logger_conv.free == LDKLogger_JCalls_free) {
14483 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14484 LDKLogger_JCalls_clone(logger_conv.this_arg);
14486 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);
14487 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14488 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14489 for (size_t u = 0; u < ret_var.datalen; u++) {
14490 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14491 *ret_conv_46_ref = ret_var.data[u];
14492 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14494 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14495 FREE(ret_var.data);
14499 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) {
14500 LDKChannelMonitor this_arg_conv;
14501 this_arg_conv.inner = (void*)(this_arg & (~1));
14502 this_arg_conv.is_owned = false;
14503 unsigned char txid_arr[32];
14504 CHECK((*env)->GetArrayLength(env, txid) == 32);
14505 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14506 unsigned char (*txid_ref)[32] = &txid_arr;
14507 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14508 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14509 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14510 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14512 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14513 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14514 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14515 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14517 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14518 if (logger_conv.free == LDKLogger_JCalls_free) {
14519 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14520 LDKLogger_JCalls_clone(logger_conv.this_arg);
14522 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
14525 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) {
14526 LDKChannelMonitor this_arg_conv;
14527 this_arg_conv.inner = (void*)(this_arg & (~1));
14528 this_arg_conv.is_owned = false;
14529 unsigned char header_arr[80];
14530 CHECK((*env)->GetArrayLength(env, header) == 80);
14531 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14532 unsigned char (*header_ref)[80] = &header_arr;
14533 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14534 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14535 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14536 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14538 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14539 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14540 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14541 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14543 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14544 if (logger_conv.free == LDKLogger_JCalls_free) {
14545 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14546 LDKLogger_JCalls_clone(logger_conv.this_arg);
14548 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14549 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14550 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14551 for (size_t u = 0; u < ret_var.datalen; u++) {
14552 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14553 *ret_conv_46_ref = ret_var.data[u];
14554 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14556 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14557 FREE(ret_var.data);
14561 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
14562 LDKChannelMonitor this_arg_conv;
14563 this_arg_conv.inner = (void*)(this_arg & (~1));
14564 this_arg_conv.is_owned = false;
14565 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
14566 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14568 for (size_t i = 0; i < ret_var.datalen; i++) {
14569 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
14570 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
14571 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14573 FREE(ret_var.data);
14577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14578 if ((this_ptr & 1) != 0) return;
14579 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
14580 FREE((void*)this_ptr);
14581 Persist_free(this_ptr_conv);
14584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
14585 LDKu8slice ser_ref;
14586 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14587 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14588 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
14589 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14590 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
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_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14596 LDKOutPoint 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 OutPoint_free(this_obj_conv);
14602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
14603 LDKOutPoint this_ptr_conv;
14604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14605 this_ptr_conv.is_owned = false;
14606 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14607 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
14611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14612 LDKOutPoint this_ptr_conv;
14613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14614 this_ptr_conv.is_owned = false;
14615 LDKThirtyTwoBytes val_ref;
14616 CHECK((*env)->GetArrayLength(env, val) == 32);
14617 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14618 OutPoint_set_txid(&this_ptr_conv, val_ref);
14621 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
14622 LDKOutPoint this_ptr_conv;
14623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14624 this_ptr_conv.is_owned = false;
14625 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
14629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14630 LDKOutPoint this_ptr_conv;
14631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14632 this_ptr_conv.is_owned = false;
14633 OutPoint_set_index(&this_ptr_conv, val);
14636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
14637 LDKThirtyTwoBytes txid_arg_ref;
14638 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
14639 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
14640 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
14641 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14642 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14643 uint64_t ret_ref = (uint64_t)ret_var.inner;
14644 if (ret_var.is_owned) {
14650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14651 LDKOutPoint orig_conv;
14652 orig_conv.inner = (void*)(orig & (~1));
14653 orig_conv.is_owned = false;
14654 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
14655 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14656 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14657 uint64_t ret_ref = (uint64_t)ret_var.inner;
14658 if (ret_var.is_owned) {
14664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
14665 LDKOutPoint a_conv;
14666 a_conv.inner = (void*)(a & (~1));
14667 a_conv.is_owned = false;
14668 LDKOutPoint b_conv;
14669 b_conv.inner = (void*)(b & (~1));
14670 b_conv.is_owned = false;
14671 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
14675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
14676 LDKOutPoint o_conv;
14677 o_conv.inner = (void*)(o & (~1));
14678 o_conv.is_owned = false;
14679 int64_t ret_val = OutPoint_hash(&o_conv);
14683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14684 LDKOutPoint this_arg_conv;
14685 this_arg_conv.inner = (void*)(this_arg & (~1));
14686 this_arg_conv.is_owned = false;
14687 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14688 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
14692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
14693 LDKOutPoint obj_conv;
14694 obj_conv.inner = (void*)(obj & (~1));
14695 obj_conv.is_owned = false;
14696 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
14697 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14698 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14699 CVec_u8Z_free(ret_var);
14703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14704 LDKu8slice ser_ref;
14705 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14706 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14707 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14708 *ret_conv = OutPoint_read(ser_ref);
14709 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14710 return (uint64_t)ret_conv;
14713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14714 LDKDelayedPaymentOutputDescriptor this_obj_conv;
14715 this_obj_conv.inner = (void*)(this_obj & (~1));
14716 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14717 DelayedPaymentOutputDescriptor_free(this_obj_conv);
14720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14721 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14723 this_ptr_conv.is_owned = false;
14724 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14725 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14726 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14727 uint64_t ret_ref = (uint64_t)ret_var.inner;
14728 if (ret_var.is_owned) {
14734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14735 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14737 this_ptr_conv.is_owned = false;
14738 LDKOutPoint val_conv;
14739 val_conv.inner = (void*)(val & (~1));
14740 val_conv.is_owned = (val & 1) || (val == 0);
14741 val_conv = OutPoint_clone(&val_conv);
14742 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14746 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14748 this_ptr_conv.is_owned = false;
14749 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14750 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
14754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14755 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14757 this_ptr_conv.is_owned = false;
14758 LDKPublicKey val_ref;
14759 CHECK((*env)->GetArrayLength(env, val) == 33);
14760 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14761 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
14764 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14765 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14767 this_ptr_conv.is_owned = false;
14768 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
14772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14773 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14775 this_ptr_conv.is_owned = false;
14776 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
14779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14780 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14782 this_ptr_conv.is_owned = false;
14783 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14784 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14788 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14790 this_ptr_conv.is_owned = false;
14791 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14792 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
14796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14797 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14799 this_ptr_conv.is_owned = false;
14800 LDKPublicKey val_ref;
14801 CHECK((*env)->GetArrayLength(env, val) == 33);
14802 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14803 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
14806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14807 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14809 this_ptr_conv.is_owned = false;
14810 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14811 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14816 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14818 this_ptr_conv.is_owned = false;
14819 LDKThirtyTwoBytes val_ref;
14820 CHECK((*env)->GetArrayLength(env, val) == 32);
14821 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14822 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14826 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14828 this_ptr_conv.is_owned = false;
14829 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14834 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14836 this_ptr_conv.is_owned = false;
14837 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14840 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) {
14841 LDKOutPoint outpoint_arg_conv;
14842 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14843 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14844 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14845 LDKPublicKey per_commitment_point_arg_ref;
14846 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
14847 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14848 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14849 LDKPublicKey revocation_pubkey_arg_ref;
14850 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
14851 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
14852 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14853 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14854 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14855 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);
14856 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14857 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14858 uint64_t ret_ref = (uint64_t)ret_var.inner;
14859 if (ret_var.is_owned) {
14865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14866 LDKDelayedPaymentOutputDescriptor orig_conv;
14867 orig_conv.inner = (void*)(orig & (~1));
14868 orig_conv.is_owned = false;
14869 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
14870 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14871 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14872 uint64_t ret_ref = (uint64_t)ret_var.inner;
14873 if (ret_var.is_owned) {
14879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14880 LDKDelayedPaymentOutputDescriptor obj_conv;
14881 obj_conv.inner = (void*)(obj & (~1));
14882 obj_conv.is_owned = false;
14883 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
14884 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14885 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14886 CVec_u8Z_free(ret_var);
14890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14891 LDKu8slice ser_ref;
14892 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14893 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14894 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14895 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
14896 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14897 return (uint64_t)ret_conv;
14900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14901 LDKStaticPaymentOutputDescriptor this_obj_conv;
14902 this_obj_conv.inner = (void*)(this_obj & (~1));
14903 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14904 StaticPaymentOutputDescriptor_free(this_obj_conv);
14907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14908 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14910 this_ptr_conv.is_owned = false;
14911 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14912 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14913 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14914 uint64_t ret_ref = (uint64_t)ret_var.inner;
14915 if (ret_var.is_owned) {
14921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14922 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14924 this_ptr_conv.is_owned = false;
14925 LDKOutPoint val_conv;
14926 val_conv.inner = (void*)(val & (~1));
14927 val_conv.is_owned = (val & 1) || (val == 0);
14928 val_conv = OutPoint_clone(&val_conv);
14929 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14933 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14935 this_ptr_conv.is_owned = false;
14936 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14937 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14941 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14943 this_ptr_conv.is_owned = false;
14944 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14945 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14950 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14952 this_ptr_conv.is_owned = false;
14953 LDKThirtyTwoBytes val_ref;
14954 CHECK((*env)->GetArrayLength(env, val) == 32);
14955 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14956 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14960 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14962 this_ptr_conv.is_owned = false;
14963 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14968 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14970 this_ptr_conv.is_owned = false;
14971 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14974 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) {
14975 LDKOutPoint outpoint_arg_conv;
14976 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14977 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14978 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14979 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14980 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14981 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14982 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14983 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
14984 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14985 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14986 uint64_t ret_ref = (uint64_t)ret_var.inner;
14987 if (ret_var.is_owned) {
14993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14994 LDKStaticPaymentOutputDescriptor orig_conv;
14995 orig_conv.inner = (void*)(orig & (~1));
14996 orig_conv.is_owned = false;
14997 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
14998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15000 uint64_t ret_ref = (uint64_t)ret_var.inner;
15001 if (ret_var.is_owned) {
15007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15008 LDKStaticPaymentOutputDescriptor obj_conv;
15009 obj_conv.inner = (void*)(obj & (~1));
15010 obj_conv.is_owned = false;
15011 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
15012 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15013 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15014 CVec_u8Z_free(ret_var);
15018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15019 LDKu8slice ser_ref;
15020 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15021 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15022 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15023 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
15024 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15025 return (uint64_t)ret_conv;
15028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15029 if ((this_ptr & 1) != 0) return;
15030 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
15031 FREE((void*)this_ptr);
15032 SpendableOutputDescriptor_free(this_ptr_conv);
15035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15036 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
15037 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15038 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
15039 uint64_t ret_ref = (uint64_t)ret_copy;
15043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15044 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
15045 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
15046 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15047 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15048 CVec_u8Z_free(ret_var);
15052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15053 LDKu8slice ser_ref;
15054 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15055 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15056 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15057 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
15058 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15059 return (uint64_t)ret_conv;
15062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15063 if ((this_ptr & 1) != 0) return;
15064 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
15065 FREE((void*)this_ptr);
15066 BaseSign_free(this_ptr_conv);
15069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15070 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
15071 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
15072 *ret = Sign_clone(orig_conv);
15073 return (uint64_t)ret;
15076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15077 if ((this_ptr & 1) != 0) return;
15078 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
15079 FREE((void*)this_ptr);
15080 Sign_free(this_ptr_conv);
15083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15084 if ((this_ptr & 1) != 0) return;
15085 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
15086 FREE((void*)this_ptr);
15087 KeysInterface_free(this_ptr_conv);
15090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15091 LDKInMemorySigner this_obj_conv;
15092 this_obj_conv.inner = (void*)(this_obj & (~1));
15093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15094 InMemorySigner_free(this_obj_conv);
15097 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15098 LDKInMemorySigner this_ptr_conv;
15099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15100 this_ptr_conv.is_owned = false;
15101 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15102 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
15106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15107 LDKInMemorySigner this_ptr_conv;
15108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15109 this_ptr_conv.is_owned = false;
15110 LDKSecretKey val_ref;
15111 CHECK((*env)->GetArrayLength(env, val) == 32);
15112 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15113 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
15116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15117 LDKInMemorySigner this_ptr_conv;
15118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15119 this_ptr_conv.is_owned = false;
15120 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15121 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
15125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15126 LDKInMemorySigner this_ptr_conv;
15127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15128 this_ptr_conv.is_owned = false;
15129 LDKSecretKey val_ref;
15130 CHECK((*env)->GetArrayLength(env, val) == 32);
15131 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15132 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
15135 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15136 LDKInMemorySigner this_ptr_conv;
15137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15138 this_ptr_conv.is_owned = false;
15139 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15140 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
15144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15145 LDKInMemorySigner this_ptr_conv;
15146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15147 this_ptr_conv.is_owned = false;
15148 LDKSecretKey val_ref;
15149 CHECK((*env)->GetArrayLength(env, val) == 32);
15150 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15151 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
15154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15155 LDKInMemorySigner this_ptr_conv;
15156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15157 this_ptr_conv.is_owned = false;
15158 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15159 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
15163 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) {
15164 LDKInMemorySigner this_ptr_conv;
15165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15166 this_ptr_conv.is_owned = false;
15167 LDKSecretKey val_ref;
15168 CHECK((*env)->GetArrayLength(env, val) == 32);
15169 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15170 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
15173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15174 LDKInMemorySigner this_ptr_conv;
15175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15176 this_ptr_conv.is_owned = false;
15177 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15178 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
15182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15183 LDKInMemorySigner this_ptr_conv;
15184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15185 this_ptr_conv.is_owned = false;
15186 LDKSecretKey val_ref;
15187 CHECK((*env)->GetArrayLength(env, val) == 32);
15188 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15189 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
15192 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
15193 LDKInMemorySigner this_ptr_conv;
15194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15195 this_ptr_conv.is_owned = false;
15196 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15197 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
15201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15202 LDKInMemorySigner this_ptr_conv;
15203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15204 this_ptr_conv.is_owned = false;
15205 LDKThirtyTwoBytes val_ref;
15206 CHECK((*env)->GetArrayLength(env, val) == 32);
15207 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15208 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
15211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15212 LDKInMemorySigner orig_conv;
15213 orig_conv.inner = (void*)(orig & (~1));
15214 orig_conv.is_owned = false;
15215 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_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 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) {
15226 LDKSecretKey funding_key_ref;
15227 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
15228 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
15229 LDKSecretKey revocation_base_key_ref;
15230 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
15231 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
15232 LDKSecretKey payment_key_ref;
15233 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
15234 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
15235 LDKSecretKey delayed_payment_base_key_ref;
15236 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
15237 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
15238 LDKSecretKey htlc_base_key_ref;
15239 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
15240 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
15241 LDKThirtyTwoBytes commitment_seed_ref;
15242 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
15243 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
15244 LDKThirtyTwoBytes channel_keys_id_ref;
15245 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
15246 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
15247 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);
15248 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15249 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15250 uint64_t ret_ref = (uint64_t)ret_var.inner;
15251 if (ret_var.is_owned) {
15257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15258 LDKInMemorySigner this_arg_conv;
15259 this_arg_conv.inner = (void*)(this_arg & (~1));
15260 this_arg_conv.is_owned = false;
15261 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
15262 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15263 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15264 uint64_t ret_ref = (uint64_t)ret_var.inner;
15265 if (ret_var.is_owned) {
15271 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
15272 LDKInMemorySigner this_arg_conv;
15273 this_arg_conv.inner = (void*)(this_arg & (~1));
15274 this_arg_conv.is_owned = false;
15275 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
15279 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
15280 LDKInMemorySigner this_arg_conv;
15281 this_arg_conv.inner = (void*)(this_arg & (~1));
15282 this_arg_conv.is_owned = false;
15283 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
15287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
15288 LDKInMemorySigner this_arg_conv;
15289 this_arg_conv.inner = (void*)(this_arg & (~1));
15290 this_arg_conv.is_owned = false;
15291 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
15295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
15296 LDKInMemorySigner this_arg_conv;
15297 this_arg_conv.inner = (void*)(this_arg & (~1));
15298 this_arg_conv.is_owned = false;
15299 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
15300 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15301 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15302 uint64_t ret_ref = (uint64_t)ret_var.inner;
15303 if (ret_var.is_owned) {
15309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
15310 LDKInMemorySigner this_arg_conv;
15311 this_arg_conv.inner = (void*)(this_arg & (~1));
15312 this_arg_conv.is_owned = false;
15313 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
15314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15316 uint64_t ret_ref = (uint64_t)ret_var.inner;
15317 if (ret_var.is_owned) {
15323 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) {
15324 LDKInMemorySigner this_arg_conv;
15325 this_arg_conv.inner = (void*)(this_arg & (~1));
15326 this_arg_conv.is_owned = false;
15327 LDKTransaction spend_tx_ref;
15328 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15329 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15330 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15331 spend_tx_ref.data_is_owned = true;
15332 LDKStaticPaymentOutputDescriptor descriptor_conv;
15333 descriptor_conv.inner = (void*)(descriptor & (~1));
15334 descriptor_conv.is_owned = false;
15335 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15336 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15337 return (uint64_t)ret_conv;
15340 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) {
15341 LDKInMemorySigner this_arg_conv;
15342 this_arg_conv.inner = (void*)(this_arg & (~1));
15343 this_arg_conv.is_owned = false;
15344 LDKTransaction spend_tx_ref;
15345 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15346 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15347 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15348 spend_tx_ref.data_is_owned = true;
15349 LDKDelayedPaymentOutputDescriptor descriptor_conv;
15350 descriptor_conv.inner = (void*)(descriptor & (~1));
15351 descriptor_conv.is_owned = false;
15352 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15353 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15354 return (uint64_t)ret_conv;
15357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
15358 LDKInMemorySigner this_arg_conv;
15359 this_arg_conv.inner = (void*)(this_arg & (~1));
15360 this_arg_conv.is_owned = false;
15361 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
15362 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
15363 return (uint64_t)ret;
15366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
15367 LDKInMemorySigner this_arg_conv;
15368 this_arg_conv.inner = (void*)(this_arg & (~1));
15369 this_arg_conv.is_owned = false;
15370 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
15371 *ret = InMemorySigner_as_Sign(&this_arg_conv);
15372 return (uint64_t)ret;
15375 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
15376 LDKInMemorySigner obj_conv;
15377 obj_conv.inner = (void*)(obj & (~1));
15378 obj_conv.is_owned = false;
15379 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
15380 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15381 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15382 CVec_u8Z_free(ret_var);
15386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15387 LDKu8slice ser_ref;
15388 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15389 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15390 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15391 *ret_conv = InMemorySigner_read(ser_ref);
15392 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15393 return (uint64_t)ret_conv;
15396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15397 LDKKeysManager this_obj_conv;
15398 this_obj_conv.inner = (void*)(this_obj & (~1));
15399 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15400 KeysManager_free(this_obj_conv);
15403 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) {
15404 unsigned char seed_arr[32];
15405 CHECK((*env)->GetArrayLength(env, seed) == 32);
15406 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
15407 unsigned char (*seed_ref)[32] = &seed_arr;
15408 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
15409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15411 uint64_t ret_ref = (uint64_t)ret_var.inner;
15412 if (ret_var.is_owned) {
15418 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) {
15419 LDKKeysManager this_arg_conv;
15420 this_arg_conv.inner = (void*)(this_arg & (~1));
15421 this_arg_conv.is_owned = false;
15422 unsigned char params_arr[32];
15423 CHECK((*env)->GetArrayLength(env, params) == 32);
15424 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
15425 unsigned char (*params_ref)[32] = ¶ms_arr;
15426 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
15427 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15428 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15429 uint64_t ret_ref = (uint64_t)ret_var.inner;
15430 if (ret_var.is_owned) {
15436 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) {
15437 LDKKeysManager this_arg_conv;
15438 this_arg_conv.inner = (void*)(this_arg & (~1));
15439 this_arg_conv.is_owned = false;
15440 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
15441 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
15442 if (descriptors_constr.datalen > 0)
15443 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15445 descriptors_constr.data = NULL;
15446 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
15447 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
15448 int64_t descriptors_conv_27 = descriptors_vals[b];
15449 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
15450 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
15451 descriptors_constr.data[b] = descriptors_conv_27_conv;
15453 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
15454 LDKCVec_TxOutZ outputs_constr;
15455 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
15456 if (outputs_constr.datalen > 0)
15457 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15459 outputs_constr.data = NULL;
15460 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
15461 for (size_t h = 0; h < outputs_constr.datalen; h++) {
15462 int64_t outputs_conv_7 = outputs_vals[h];
15463 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
15464 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
15465 outputs_constr.data[h] = outputs_conv_7_conv;
15467 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
15468 LDKCVec_u8Z change_destination_script_ref;
15469 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
15470 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
15471 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
15472 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15473 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
15474 return (uint64_t)ret_conv;
15477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
15478 LDKKeysManager this_arg_conv;
15479 this_arg_conv.inner = (void*)(this_arg & (~1));
15480 this_arg_conv.is_owned = false;
15481 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
15482 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
15483 return (uint64_t)ret;
15486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15487 LDKChannelManager this_obj_conv;
15488 this_obj_conv.inner = (void*)(this_obj & (~1));
15489 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15490 ChannelManager_free(this_obj_conv);
15493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15494 LDKChainParameters this_obj_conv;
15495 this_obj_conv.inner = (void*)(this_obj & (~1));
15496 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15497 ChainParameters_free(this_obj_conv);
15500 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
15501 LDKChainParameters this_ptr_conv;
15502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15503 this_ptr_conv.is_owned = false;
15504 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
15508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
15509 LDKChainParameters this_ptr_conv;
15510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15511 this_ptr_conv.is_owned = false;
15512 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
15513 ChainParameters_set_network(&this_ptr_conv, val_conv);
15516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
15517 LDKChainParameters this_ptr_conv;
15518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15519 this_ptr_conv.is_owned = false;
15520 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
15521 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15522 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15523 uint64_t ret_ref = (uint64_t)ret_var.inner;
15524 if (ret_var.is_owned) {
15530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15531 LDKChainParameters this_ptr_conv;
15532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15533 this_ptr_conv.is_owned = false;
15534 LDKBestBlock val_conv;
15535 val_conv.inner = (void*)(val & (~1));
15536 val_conv.is_owned = (val & 1) || (val == 0);
15537 val_conv = BestBlock_clone(&val_conv);
15538 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
15541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
15542 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
15543 LDKBestBlock best_block_arg_conv;
15544 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
15545 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
15546 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
15547 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
15548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15550 uint64_t ret_ref = (uint64_t)ret_var.inner;
15551 if (ret_var.is_owned) {
15557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15558 LDKChainParameters orig_conv;
15559 orig_conv.inner = (void*)(orig & (~1));
15560 orig_conv.is_owned = false;
15561 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
15562 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15563 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15564 uint64_t ret_ref = (uint64_t)ret_var.inner;
15565 if (ret_var.is_owned) {
15571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15572 LDKBestBlock this_obj_conv;
15573 this_obj_conv.inner = (void*)(this_obj & (~1));
15574 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15575 BestBlock_free(this_obj_conv);
15578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15579 LDKBestBlock orig_conv;
15580 orig_conv.inner = (void*)(orig & (~1));
15581 orig_conv.is_owned = false;
15582 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
15583 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15584 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15585 uint64_t ret_ref = (uint64_t)ret_var.inner;
15586 if (ret_var.is_owned) {
15592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
15593 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
15594 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
15595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15597 uint64_t ret_ref = (uint64_t)ret_var.inner;
15598 if (ret_var.is_owned) {
15604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
15605 LDKThirtyTwoBytes block_hash_ref;
15606 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
15607 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
15608 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
15609 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15610 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15611 uint64_t ret_ref = (uint64_t)ret_var.inner;
15612 if (ret_var.is_owned) {
15618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
15619 LDKBestBlock this_arg_conv;
15620 this_arg_conv.inner = (void*)(this_arg & (~1));
15621 this_arg_conv.is_owned = false;
15622 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15623 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
15627 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
15628 LDKBestBlock this_arg_conv;
15629 this_arg_conv.inner = (void*)(this_arg & (~1));
15630 this_arg_conv.is_owned = false;
15631 int32_t ret_val = BestBlock_height(&this_arg_conv);
15635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15636 LDKChannelDetails this_obj_conv;
15637 this_obj_conv.inner = (void*)(this_obj & (~1));
15638 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15639 ChannelDetails_free(this_obj_conv);
15642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15643 LDKChannelDetails this_ptr_conv;
15644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15645 this_ptr_conv.is_owned = false;
15646 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15647 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
15651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15652 LDKChannelDetails this_ptr_conv;
15653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15654 this_ptr_conv.is_owned = false;
15655 LDKThirtyTwoBytes val_ref;
15656 CHECK((*env)->GetArrayLength(env, val) == 32);
15657 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15658 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
15661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
15662 LDKChannelDetails this_ptr_conv;
15663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15664 this_ptr_conv.is_owned = false;
15665 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
15666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15668 uint64_t ret_ref = (uint64_t)ret_var.inner;
15669 if (ret_var.is_owned) {
15675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15676 LDKChannelDetails this_ptr_conv;
15677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15678 this_ptr_conv.is_owned = false;
15679 LDKOutPoint val_conv;
15680 val_conv.inner = (void*)(val & (~1));
15681 val_conv.is_owned = (val & 1) || (val == 0);
15682 val_conv = OutPoint_clone(&val_conv);
15683 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
15686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15687 LDKChannelDetails this_ptr_conv;
15688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15689 this_ptr_conv.is_owned = false;
15690 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15691 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
15692 uint64_t ret_ref = (uint64_t)ret_copy;
15696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15697 LDKChannelDetails this_ptr_conv;
15698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15699 this_ptr_conv.is_owned = false;
15700 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15701 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
15704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15705 LDKChannelDetails this_ptr_conv;
15706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15707 this_ptr_conv.is_owned = false;
15708 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15709 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
15713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15714 LDKChannelDetails this_ptr_conv;
15715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15716 this_ptr_conv.is_owned = false;
15717 LDKPublicKey val_ref;
15718 CHECK((*env)->GetArrayLength(env, val) == 33);
15719 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15720 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
15723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15724 LDKChannelDetails this_ptr_conv;
15725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15726 this_ptr_conv.is_owned = false;
15727 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
15728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15730 uint64_t ret_ref = (uint64_t)ret_var.inner;
15731 if (ret_var.is_owned) {
15737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15738 LDKChannelDetails this_ptr_conv;
15739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15740 this_ptr_conv.is_owned = false;
15741 LDKInitFeatures val_conv;
15742 val_conv.inner = (void*)(val & (~1));
15743 val_conv.is_owned = (val & 1) || (val == 0);
15744 val_conv = InitFeatures_clone(&val_conv);
15745 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
15748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15749 LDKChannelDetails this_ptr_conv;
15750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15751 this_ptr_conv.is_owned = false;
15752 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
15756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15757 LDKChannelDetails this_ptr_conv;
15758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15759 this_ptr_conv.is_owned = false;
15760 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
15763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15764 LDKChannelDetails this_ptr_conv;
15765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15766 this_ptr_conv.is_owned = false;
15767 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
15771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15772 LDKChannelDetails this_ptr_conv;
15773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15774 this_ptr_conv.is_owned = false;
15775 ChannelDetails_set_user_id(&this_ptr_conv, val);
15778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15779 LDKChannelDetails this_ptr_conv;
15780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15781 this_ptr_conv.is_owned = false;
15782 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
15786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15787 LDKChannelDetails this_ptr_conv;
15788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15789 this_ptr_conv.is_owned = false;
15790 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
15793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15794 LDKChannelDetails this_ptr_conv;
15795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15796 this_ptr_conv.is_owned = false;
15797 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
15801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15802 LDKChannelDetails this_ptr_conv;
15803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15804 this_ptr_conv.is_owned = false;
15805 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
15808 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
15809 LDKChannelDetails this_ptr_conv;
15810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15811 this_ptr_conv.is_owned = false;
15812 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
15816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15817 LDKChannelDetails this_ptr_conv;
15818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15819 this_ptr_conv.is_owned = false;
15820 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
15823 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
15824 LDKChannelDetails this_ptr_conv;
15825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15826 this_ptr_conv.is_owned = false;
15827 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
15831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15832 LDKChannelDetails this_ptr_conv;
15833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15834 this_ptr_conv.is_owned = false;
15835 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
15838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
15839 LDKChannelDetails this_ptr_conv;
15840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15841 this_ptr_conv.is_owned = false;
15842 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
15846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15847 LDKChannelDetails this_ptr_conv;
15848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15849 this_ptr_conv.is_owned = false;
15850 ChannelDetails_set_is_usable(&this_ptr_conv, val);
15853 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
15854 LDKChannelDetails this_ptr_conv;
15855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15856 this_ptr_conv.is_owned = false;
15857 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
15861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15862 LDKChannelDetails this_ptr_conv;
15863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15864 this_ptr_conv.is_owned = false;
15865 ChannelDetails_set_is_public(&this_ptr_conv, val);
15868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15869 LDKChannelDetails orig_conv;
15870 orig_conv.inner = (void*)(orig & (~1));
15871 orig_conv.is_owned = false;
15872 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
15873 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15874 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15875 uint64_t ret_ref = (uint64_t)ret_var.inner;
15876 if (ret_var.is_owned) {
15882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15883 if ((this_ptr & 1) != 0) return;
15884 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
15885 FREE((void*)this_ptr);
15886 PaymentSendFailure_free(this_ptr_conv);
15889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15890 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
15891 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15892 *ret_copy = PaymentSendFailure_clone(orig_conv);
15893 uint64_t ret_ref = (uint64_t)ret_copy;
15897 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) {
15898 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
15899 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
15900 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15901 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
15903 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
15904 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
15905 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15906 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
15908 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
15909 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15910 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15911 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
15913 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15914 if (logger_conv.free == LDKLogger_JCalls_free) {
15915 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15916 LDKLogger_JCalls_clone(logger_conv.this_arg);
15918 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
15919 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
15920 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15921 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
15923 LDKUserConfig config_conv;
15924 config_conv.inner = (void*)(config & (~1));
15925 config_conv.is_owned = (config & 1) || (config == 0);
15926 config_conv = UserConfig_clone(&config_conv);
15927 LDKChainParameters params_conv;
15928 params_conv.inner = (void*)(params & (~1));
15929 params_conv.is_owned = (params & 1) || (params == 0);
15930 params_conv = ChainParameters_clone(¶ms_conv);
15931 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
15932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15934 uint64_t ret_ref = (uint64_t)ret_var.inner;
15935 if (ret_var.is_owned) {
15941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
15942 LDKChannelManager this_arg_conv;
15943 this_arg_conv.inner = (void*)(this_arg & (~1));
15944 this_arg_conv.is_owned = false;
15945 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
15946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15948 uint64_t ret_ref = (uint64_t)ret_var.inner;
15949 if (ret_var.is_owned) {
15955 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) {
15956 LDKChannelManager this_arg_conv;
15957 this_arg_conv.inner = (void*)(this_arg & (~1));
15958 this_arg_conv.is_owned = false;
15959 LDKPublicKey their_network_key_ref;
15960 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
15961 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
15962 LDKUserConfig override_config_conv;
15963 override_config_conv.inner = (void*)(override_config & (~1));
15964 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
15965 override_config_conv = UserConfig_clone(&override_config_conv);
15966 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15967 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
15968 return (uint64_t)ret_conv;
15971 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15972 LDKChannelManager this_arg_conv;
15973 this_arg_conv.inner = (void*)(this_arg & (~1));
15974 this_arg_conv.is_owned = false;
15975 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
15976 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15977 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15978 for (size_t q = 0; q < ret_var.datalen; q++) {
15979 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15980 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15981 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15982 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15983 if (ret_conv_16_var.is_owned) {
15984 ret_conv_16_ref |= 1;
15986 ret_arr_ptr[q] = ret_conv_16_ref;
15988 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15989 FREE(ret_var.data);
15993 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15994 LDKChannelManager this_arg_conv;
15995 this_arg_conv.inner = (void*)(this_arg & (~1));
15996 this_arg_conv.is_owned = false;
15997 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
15998 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15999 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16000 for (size_t q = 0; q < ret_var.datalen; q++) {
16001 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
16002 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16003 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16004 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
16005 if (ret_conv_16_var.is_owned) {
16006 ret_conv_16_ref |= 1;
16008 ret_arr_ptr[q] = ret_conv_16_ref;
16010 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16011 FREE(ret_var.data);
16015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
16016 LDKChannelManager this_arg_conv;
16017 this_arg_conv.inner = (void*)(this_arg & (~1));
16018 this_arg_conv.is_owned = false;
16019 unsigned char channel_id_arr[32];
16020 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
16021 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
16022 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16023 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16024 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
16025 return (uint64_t)ret_conv;
16028 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) {
16029 LDKChannelManager this_arg_conv;
16030 this_arg_conv.inner = (void*)(this_arg & (~1));
16031 this_arg_conv.is_owned = false;
16032 unsigned char channel_id_arr[32];
16033 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
16034 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
16035 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16036 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16037 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
16038 return (uint64_t)ret_conv;
16041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
16042 LDKChannelManager this_arg_conv;
16043 this_arg_conv.inner = (void*)(this_arg & (~1));
16044 this_arg_conv.is_owned = false;
16045 ChannelManager_force_close_all_channels(&this_arg_conv);
16048 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) {
16049 LDKChannelManager this_arg_conv;
16050 this_arg_conv.inner = (void*)(this_arg & (~1));
16051 this_arg_conv.is_owned = false;
16052 LDKRoute route_conv;
16053 route_conv.inner = (void*)(route & (~1));
16054 route_conv.is_owned = false;
16055 LDKThirtyTwoBytes payment_hash_ref;
16056 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
16057 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
16058 LDKThirtyTwoBytes payment_secret_ref;
16059 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
16060 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
16061 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16062 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
16063 return (uint64_t)ret_conv;
16066 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) {
16067 LDKChannelManager this_arg_conv;
16068 this_arg_conv.inner = (void*)(this_arg & (~1));
16069 this_arg_conv.is_owned = false;
16070 unsigned char temporary_channel_id_arr[32];
16071 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
16072 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
16073 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
16074 LDKTransaction funding_transaction_ref;
16075 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
16076 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
16077 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
16078 funding_transaction_ref.data_is_owned = true;
16079 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16080 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
16081 return (uint64_t)ret_conv;
16084 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) {
16085 LDKChannelManager this_arg_conv;
16086 this_arg_conv.inner = (void*)(this_arg & (~1));
16087 this_arg_conv.is_owned = false;
16088 LDKThreeBytes rgb_ref;
16089 CHECK((*env)->GetArrayLength(env, rgb) == 3);
16090 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
16091 LDKThirtyTwoBytes alias_ref;
16092 CHECK((*env)->GetArrayLength(env, alias) == 32);
16093 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
16094 LDKCVec_NetAddressZ addresses_constr;
16095 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
16096 if (addresses_constr.datalen > 0)
16097 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16099 addresses_constr.data = NULL;
16100 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
16101 for (size_t m = 0; m < addresses_constr.datalen; m++) {
16102 int64_t addresses_conv_12 = addresses_vals[m];
16103 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
16104 addresses_constr.data[m] = addresses_conv_12_conv;
16106 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
16107 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
16110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
16111 LDKChannelManager this_arg_conv;
16112 this_arg_conv.inner = (void*)(this_arg & (~1));
16113 this_arg_conv.is_owned = false;
16114 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
16117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
16118 LDKChannelManager this_arg_conv;
16119 this_arg_conv.inner = (void*)(this_arg & (~1));
16120 this_arg_conv.is_owned = false;
16121 ChannelManager_timer_tick_occurred(&this_arg_conv);
16124 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
16125 LDKChannelManager this_arg_conv;
16126 this_arg_conv.inner = (void*)(this_arg & (~1));
16127 this_arg_conv.is_owned = false;
16128 unsigned char payment_hash_arr[32];
16129 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
16130 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
16131 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
16132 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
16136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
16137 LDKChannelManager this_arg_conv;
16138 this_arg_conv.inner = (void*)(this_arg & (~1));
16139 this_arg_conv.is_owned = false;
16140 LDKThirtyTwoBytes payment_preimage_ref;
16141 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
16142 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
16143 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
16147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
16148 LDKChannelManager this_arg_conv;
16149 this_arg_conv.inner = (void*)(this_arg & (~1));
16150 this_arg_conv.is_owned = false;
16151 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16152 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
16156 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) {
16157 LDKChannelManager this_arg_conv;
16158 this_arg_conv.inner = (void*)(this_arg & (~1));
16159 this_arg_conv.is_owned = false;
16160 LDKOutPoint funding_txo_conv;
16161 funding_txo_conv.inner = (void*)(funding_txo & (~1));
16162 funding_txo_conv.is_owned = false;
16163 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
16166 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) {
16167 LDKChannelManager this_arg_conv;
16168 this_arg_conv.inner = (void*)(this_arg & (~1));
16169 this_arg_conv.is_owned = false;
16170 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
16171 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16172 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
16173 return (uint64_t)ret_ref;
16176 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) {
16177 LDKChannelManager this_arg_conv;
16178 this_arg_conv.inner = (void*)(this_arg & (~1));
16179 this_arg_conv.is_owned = false;
16180 LDKThirtyTwoBytes payment_hash_ref;
16181 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
16182 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
16183 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
16184 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16185 *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);
16186 return (uint64_t)ret_conv;
16189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16190 LDKChannelManager this_arg_conv;
16191 this_arg_conv.inner = (void*)(this_arg & (~1));
16192 this_arg_conv.is_owned = false;
16193 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16194 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
16195 return (uint64_t)ret;
16198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16199 LDKChannelManager this_arg_conv;
16200 this_arg_conv.inner = (void*)(this_arg & (~1));
16201 this_arg_conv.is_owned = false;
16202 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
16203 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
16204 return (uint64_t)ret;
16207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
16208 LDKChannelManager this_arg_conv;
16209 this_arg_conv.inner = (void*)(this_arg & (~1));
16210 this_arg_conv.is_owned = false;
16211 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
16212 *ret = ChannelManager_as_Listen(&this_arg_conv);
16213 return (uint64_t)ret;
16216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
16217 LDKChannelManager this_arg_conv;
16218 this_arg_conv.inner = (void*)(this_arg & (~1));
16219 this_arg_conv.is_owned = false;
16220 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
16221 *ret = ChannelManager_as_Confirm(&this_arg_conv);
16222 return (uint64_t)ret;
16225 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) {
16226 LDKChannelManager this_arg_conv;
16227 this_arg_conv.inner = (void*)(this_arg & (~1));
16228 this_arg_conv.is_owned = false;
16229 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
16233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
16234 LDKChannelManager this_arg_conv;
16235 this_arg_conv.inner = (void*)(this_arg & (~1));
16236 this_arg_conv.is_owned = false;
16237 ChannelManager_await_persistable_update(&this_arg_conv);
16240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
16241 LDKChannelManager this_arg_conv;
16242 this_arg_conv.inner = (void*)(this_arg & (~1));
16243 this_arg_conv.is_owned = false;
16244 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16245 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
16246 return (uint64_t)ret;
16249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
16250 LDKChannelManager obj_conv;
16251 obj_conv.inner = (void*)(obj & (~1));
16252 obj_conv.is_owned = false;
16253 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
16254 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16255 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16256 CVec_u8Z_free(ret_var);
16260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16261 LDKChannelManagerReadArgs this_obj_conv;
16262 this_obj_conv.inner = (void*)(this_obj & (~1));
16263 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16264 ChannelManagerReadArgs_free(this_obj_conv);
16267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
16268 LDKChannelManagerReadArgs this_ptr_conv;
16269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16270 this_ptr_conv.is_owned = false;
16271 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
16275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16276 LDKChannelManagerReadArgs this_ptr_conv;
16277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16278 this_ptr_conv.is_owned = false;
16279 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
16280 if (val_conv.free == LDKKeysInterface_JCalls_free) {
16281 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16282 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
16284 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
16287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
16288 LDKChannelManagerReadArgs this_ptr_conv;
16289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16290 this_ptr_conv.is_owned = false;
16291 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
16295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16296 LDKChannelManagerReadArgs this_ptr_conv;
16297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16298 this_ptr_conv.is_owned = false;
16299 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
16300 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
16301 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16302 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
16304 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
16307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
16308 LDKChannelManagerReadArgs this_ptr_conv;
16309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16310 this_ptr_conv.is_owned = false;
16311 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
16315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16316 LDKChannelManagerReadArgs this_ptr_conv;
16317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16318 this_ptr_conv.is_owned = false;
16319 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
16320 if (val_conv.free == LDKWatch_JCalls_free) {
16321 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16322 LDKWatch_JCalls_clone(val_conv.this_arg);
16324 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
16327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
16328 LDKChannelManagerReadArgs this_ptr_conv;
16329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16330 this_ptr_conv.is_owned = false;
16331 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
16335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16336 LDKChannelManagerReadArgs this_ptr_conv;
16337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16338 this_ptr_conv.is_owned = false;
16339 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
16340 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
16341 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16342 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
16344 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
16347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
16348 LDKChannelManagerReadArgs this_ptr_conv;
16349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16350 this_ptr_conv.is_owned = false;
16351 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
16355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16356 LDKChannelManagerReadArgs this_ptr_conv;
16357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16358 this_ptr_conv.is_owned = false;
16359 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
16360 if (val_conv.free == LDKLogger_JCalls_free) {
16361 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16362 LDKLogger_JCalls_clone(val_conv.this_arg);
16364 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
16367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
16368 LDKChannelManagerReadArgs this_ptr_conv;
16369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16370 this_ptr_conv.is_owned = false;
16371 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
16372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16374 uint64_t ret_ref = (uint64_t)ret_var.inner;
16375 if (ret_var.is_owned) {
16381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16382 LDKChannelManagerReadArgs this_ptr_conv;
16383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16384 this_ptr_conv.is_owned = false;
16385 LDKUserConfig val_conv;
16386 val_conv.inner = (void*)(val & (~1));
16387 val_conv.is_owned = (val & 1) || (val == 0);
16388 val_conv = UserConfig_clone(&val_conv);
16389 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16392 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) {
16393 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16394 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
16395 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16396 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
16398 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16399 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16400 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16401 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
16403 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16404 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
16405 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16406 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
16408 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16409 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16410 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16411 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
16413 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16414 if (logger_conv.free == LDKLogger_JCalls_free) {
16415 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16416 LDKLogger_JCalls_clone(logger_conv.this_arg);
16418 LDKUserConfig default_config_conv;
16419 default_config_conv.inner = (void*)(default_config & (~1));
16420 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16421 default_config_conv = UserConfig_clone(&default_config_conv);
16422 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16423 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
16424 if (channel_monitors_constr.datalen > 0)
16425 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16427 channel_monitors_constr.data = NULL;
16428 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
16429 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16430 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
16431 LDKChannelMonitor channel_monitors_conv_16_conv;
16432 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16433 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16434 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16436 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
16437 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);
16438 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16439 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16440 uint64_t ret_ref = (uint64_t)ret_var.inner;
16441 if (ret_var.is_owned) {
16447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
16448 LDKu8slice ser_ref;
16449 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16450 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16451 LDKChannelManagerReadArgs arg_conv;
16452 arg_conv.inner = (void*)(arg & (~1));
16453 arg_conv.is_owned = (arg & 1) || (arg == 0);
16454 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16455 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16456 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16457 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16458 return (uint64_t)ret_conv;
16461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16462 LDKDecodeError this_obj_conv;
16463 this_obj_conv.inner = (void*)(this_obj & (~1));
16464 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16465 DecodeError_free(this_obj_conv);
16468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16469 LDKDecodeError orig_conv;
16470 orig_conv.inner = (void*)(orig & (~1));
16471 orig_conv.is_owned = false;
16472 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16475 uint64_t ret_ref = (uint64_t)ret_var.inner;
16476 if (ret_var.is_owned) {
16482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16483 LDKInit this_obj_conv;
16484 this_obj_conv.inner = (void*)(this_obj & (~1));
16485 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16486 Init_free(this_obj_conv);
16489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16490 LDKInit this_ptr_conv;
16491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16492 this_ptr_conv.is_owned = false;
16493 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
16494 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16495 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16496 uint64_t ret_ref = (uint64_t)ret_var.inner;
16497 if (ret_var.is_owned) {
16503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16504 LDKInit this_ptr_conv;
16505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16506 this_ptr_conv.is_owned = false;
16507 LDKInitFeatures val_conv;
16508 val_conv.inner = (void*)(val & (~1));
16509 val_conv.is_owned = (val & 1) || (val == 0);
16510 val_conv = InitFeatures_clone(&val_conv);
16511 Init_set_features(&this_ptr_conv, val_conv);
16514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
16515 LDKInitFeatures features_arg_conv;
16516 features_arg_conv.inner = (void*)(features_arg & (~1));
16517 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16518 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16519 LDKInit ret_var = Init_new(features_arg_conv);
16520 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16521 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16522 uint64_t ret_ref = (uint64_t)ret_var.inner;
16523 if (ret_var.is_owned) {
16529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16531 orig_conv.inner = (void*)(orig & (~1));
16532 orig_conv.is_owned = false;
16533 LDKInit ret_var = Init_clone(&orig_conv);
16534 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16535 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16536 uint64_t ret_ref = (uint64_t)ret_var.inner;
16537 if (ret_var.is_owned) {
16543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16544 LDKErrorMessage this_obj_conv;
16545 this_obj_conv.inner = (void*)(this_obj & (~1));
16546 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16547 ErrorMessage_free(this_obj_conv);
16550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16551 LDKErrorMessage this_ptr_conv;
16552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16553 this_ptr_conv.is_owned = false;
16554 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16555 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
16559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16560 LDKErrorMessage this_ptr_conv;
16561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16562 this_ptr_conv.is_owned = false;
16563 LDKThirtyTwoBytes val_ref;
16564 CHECK((*env)->GetArrayLength(env, val) == 32);
16565 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16566 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
16569 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
16570 LDKErrorMessage this_ptr_conv;
16571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16572 this_ptr_conv.is_owned = false;
16573 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
16574 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
16578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
16579 LDKErrorMessage this_ptr_conv;
16580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16581 this_ptr_conv.is_owned = false;
16582 LDKStr val_conv = java_to_owned_str(env, val);
16583 ErrorMessage_set_data(&this_ptr_conv, val_conv);
16586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
16587 LDKThirtyTwoBytes channel_id_arg_ref;
16588 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
16589 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
16590 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
16591 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
16592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16594 uint64_t ret_ref = (uint64_t)ret_var.inner;
16595 if (ret_var.is_owned) {
16601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16602 LDKErrorMessage orig_conv;
16603 orig_conv.inner = (void*)(orig & (~1));
16604 orig_conv.is_owned = false;
16605 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
16606 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16607 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16608 uint64_t ret_ref = (uint64_t)ret_var.inner;
16609 if (ret_var.is_owned) {
16615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16616 LDKPing this_obj_conv;
16617 this_obj_conv.inner = (void*)(this_obj & (~1));
16618 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16619 Ping_free(this_obj_conv);
16622 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16623 LDKPing this_ptr_conv;
16624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16625 this_ptr_conv.is_owned = false;
16626 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
16630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16631 LDKPing this_ptr_conv;
16632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16633 this_ptr_conv.is_owned = false;
16634 Ping_set_ponglen(&this_ptr_conv, val);
16637 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16638 LDKPing this_ptr_conv;
16639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16640 this_ptr_conv.is_owned = false;
16641 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
16645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16646 LDKPing this_ptr_conv;
16647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16648 this_ptr_conv.is_owned = false;
16649 Ping_set_byteslen(&this_ptr_conv, val);
16652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
16653 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
16654 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16655 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16656 uint64_t ret_ref = (uint64_t)ret_var.inner;
16657 if (ret_var.is_owned) {
16663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16665 orig_conv.inner = (void*)(orig & (~1));
16666 orig_conv.is_owned = false;
16667 LDKPing ret_var = Ping_clone(&orig_conv);
16668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16670 uint64_t ret_ref = (uint64_t)ret_var.inner;
16671 if (ret_var.is_owned) {
16677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16678 LDKPong this_obj_conv;
16679 this_obj_conv.inner = (void*)(this_obj & (~1));
16680 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16681 Pong_free(this_obj_conv);
16684 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16685 LDKPong this_ptr_conv;
16686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16687 this_ptr_conv.is_owned = false;
16688 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
16692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16693 LDKPong this_ptr_conv;
16694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16695 this_ptr_conv.is_owned = false;
16696 Pong_set_byteslen(&this_ptr_conv, val);
16699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
16700 LDKPong ret_var = Pong_new(byteslen_arg);
16701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16703 uint64_t ret_ref = (uint64_t)ret_var.inner;
16704 if (ret_var.is_owned) {
16710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16712 orig_conv.inner = (void*)(orig & (~1));
16713 orig_conv.is_owned = false;
16714 LDKPong ret_var = Pong_clone(&orig_conv);
16715 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16716 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16717 uint64_t ret_ref = (uint64_t)ret_var.inner;
16718 if (ret_var.is_owned) {
16724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16725 LDKOpenChannel this_obj_conv;
16726 this_obj_conv.inner = (void*)(this_obj & (~1));
16727 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16728 OpenChannel_free(this_obj_conv);
16731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16732 LDKOpenChannel this_ptr_conv;
16733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16734 this_ptr_conv.is_owned = false;
16735 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16736 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
16740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16741 LDKOpenChannel this_ptr_conv;
16742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16743 this_ptr_conv.is_owned = false;
16744 LDKThirtyTwoBytes val_ref;
16745 CHECK((*env)->GetArrayLength(env, val) == 32);
16746 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16747 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
16750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16751 LDKOpenChannel this_ptr_conv;
16752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16753 this_ptr_conv.is_owned = false;
16754 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16755 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
16759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16760 LDKOpenChannel this_ptr_conv;
16761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16762 this_ptr_conv.is_owned = false;
16763 LDKThirtyTwoBytes val_ref;
16764 CHECK((*env)->GetArrayLength(env, val) == 32);
16765 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16766 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16770 LDKOpenChannel this_ptr_conv;
16771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16772 this_ptr_conv.is_owned = false;
16773 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
16777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16778 LDKOpenChannel this_ptr_conv;
16779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16780 this_ptr_conv.is_owned = false;
16781 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
16784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16785 LDKOpenChannel this_ptr_conv;
16786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16787 this_ptr_conv.is_owned = false;
16788 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
16792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16793 LDKOpenChannel this_ptr_conv;
16794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16795 this_ptr_conv.is_owned = false;
16796 OpenChannel_set_push_msat(&this_ptr_conv, val);
16799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16800 LDKOpenChannel this_ptr_conv;
16801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16802 this_ptr_conv.is_owned = false;
16803 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
16807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16808 LDKOpenChannel this_ptr_conv;
16809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16810 this_ptr_conv.is_owned = false;
16811 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16814 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) {
16815 LDKOpenChannel this_ptr_conv;
16816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16817 this_ptr_conv.is_owned = false;
16818 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16822 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) {
16823 LDKOpenChannel this_ptr_conv;
16824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16825 this_ptr_conv.is_owned = false;
16826 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16830 LDKOpenChannel this_ptr_conv;
16831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16832 this_ptr_conv.is_owned = false;
16833 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16838 LDKOpenChannel this_ptr_conv;
16839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16840 this_ptr_conv.is_owned = false;
16841 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16845 LDKOpenChannel this_ptr_conv;
16846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16847 this_ptr_conv.is_owned = false;
16848 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
16852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16853 LDKOpenChannel this_ptr_conv;
16854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16855 this_ptr_conv.is_owned = false;
16856 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16859 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
16860 LDKOpenChannel this_ptr_conv;
16861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16862 this_ptr_conv.is_owned = false;
16863 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
16867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16868 LDKOpenChannel this_ptr_conv;
16869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16870 this_ptr_conv.is_owned = false;
16871 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
16874 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16875 LDKOpenChannel this_ptr_conv;
16876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16877 this_ptr_conv.is_owned = false;
16878 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
16882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16883 LDKOpenChannel this_ptr_conv;
16884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16885 this_ptr_conv.is_owned = false;
16886 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
16889 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16890 LDKOpenChannel this_ptr_conv;
16891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16892 this_ptr_conv.is_owned = false;
16893 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
16897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16898 LDKOpenChannel this_ptr_conv;
16899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16900 this_ptr_conv.is_owned = false;
16901 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16905 LDKOpenChannel this_ptr_conv;
16906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16907 this_ptr_conv.is_owned = false;
16908 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16909 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
16913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16914 LDKOpenChannel this_ptr_conv;
16915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16916 this_ptr_conv.is_owned = false;
16917 LDKPublicKey val_ref;
16918 CHECK((*env)->GetArrayLength(env, val) == 33);
16919 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16920 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16924 LDKOpenChannel this_ptr_conv;
16925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16926 this_ptr_conv.is_owned = false;
16927 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16928 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16933 LDKOpenChannel this_ptr_conv;
16934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16935 this_ptr_conv.is_owned = false;
16936 LDKPublicKey val_ref;
16937 CHECK((*env)->GetArrayLength(env, val) == 33);
16938 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16939 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16943 LDKOpenChannel this_ptr_conv;
16944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16945 this_ptr_conv.is_owned = false;
16946 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16947 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
16951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16952 LDKOpenChannel this_ptr_conv;
16953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16954 this_ptr_conv.is_owned = false;
16955 LDKPublicKey val_ref;
16956 CHECK((*env)->GetArrayLength(env, val) == 33);
16957 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16958 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
16961 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16962 LDKOpenChannel this_ptr_conv;
16963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16964 this_ptr_conv.is_owned = false;
16965 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16966 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16971 LDKOpenChannel this_ptr_conv;
16972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16973 this_ptr_conv.is_owned = false;
16974 LDKPublicKey val_ref;
16975 CHECK((*env)->GetArrayLength(env, val) == 33);
16976 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16977 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16981 LDKOpenChannel this_ptr_conv;
16982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16983 this_ptr_conv.is_owned = false;
16984 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16985 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16990 LDKOpenChannel this_ptr_conv;
16991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16992 this_ptr_conv.is_owned = false;
16993 LDKPublicKey val_ref;
16994 CHECK((*env)->GetArrayLength(env, val) == 33);
16995 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16996 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17000 LDKOpenChannel this_ptr_conv;
17001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17002 this_ptr_conv.is_owned = false;
17003 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17004 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
17008 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) {
17009 LDKOpenChannel this_ptr_conv;
17010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17011 this_ptr_conv.is_owned = false;
17012 LDKPublicKey val_ref;
17013 CHECK((*env)->GetArrayLength(env, val) == 33);
17014 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17015 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
17018 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
17019 LDKOpenChannel this_ptr_conv;
17020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17021 this_ptr_conv.is_owned = false;
17022 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
17026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
17027 LDKOpenChannel this_ptr_conv;
17028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17029 this_ptr_conv.is_owned = false;
17030 OpenChannel_set_channel_flags(&this_ptr_conv, val);
17033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17034 LDKOpenChannel orig_conv;
17035 orig_conv.inner = (void*)(orig & (~1));
17036 orig_conv.is_owned = false;
17037 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
17038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17040 uint64_t ret_ref = (uint64_t)ret_var.inner;
17041 if (ret_var.is_owned) {
17047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17048 LDKAcceptChannel this_obj_conv;
17049 this_obj_conv.inner = (void*)(this_obj & (~1));
17050 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17051 AcceptChannel_free(this_obj_conv);
17054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17055 LDKAcceptChannel this_ptr_conv;
17056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17057 this_ptr_conv.is_owned = false;
17058 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17059 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
17063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17064 LDKAcceptChannel this_ptr_conv;
17065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17066 this_ptr_conv.is_owned = false;
17067 LDKThirtyTwoBytes val_ref;
17068 CHECK((*env)->GetArrayLength(env, val) == 32);
17069 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17070 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
17073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17074 LDKAcceptChannel this_ptr_conv;
17075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17076 this_ptr_conv.is_owned = false;
17077 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
17081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17082 LDKAcceptChannel this_ptr_conv;
17083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17084 this_ptr_conv.is_owned = false;
17085 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
17088 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) {
17089 LDKAcceptChannel this_ptr_conv;
17090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17091 this_ptr_conv.is_owned = false;
17092 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
17096 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) {
17097 LDKAcceptChannel this_ptr_conv;
17098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17099 this_ptr_conv.is_owned = false;
17100 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17104 LDKAcceptChannel this_ptr_conv;
17105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17106 this_ptr_conv.is_owned = false;
17107 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
17111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17112 LDKAcceptChannel this_ptr_conv;
17113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17114 this_ptr_conv.is_owned = false;
17115 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
17118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17119 LDKAcceptChannel this_ptr_conv;
17120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17121 this_ptr_conv.is_owned = false;
17122 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
17126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17127 LDKAcceptChannel this_ptr_conv;
17128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17129 this_ptr_conv.is_owned = false;
17130 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
17133 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
17134 LDKAcceptChannel this_ptr_conv;
17135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17136 this_ptr_conv.is_owned = false;
17137 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
17141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17142 LDKAcceptChannel this_ptr_conv;
17143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17144 this_ptr_conv.is_owned = false;
17145 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
17148 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17149 LDKAcceptChannel this_ptr_conv;
17150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17151 this_ptr_conv.is_owned = false;
17152 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
17156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17157 LDKAcceptChannel this_ptr_conv;
17158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17159 this_ptr_conv.is_owned = false;
17160 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
17163 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
17164 LDKAcceptChannel this_ptr_conv;
17165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17166 this_ptr_conv.is_owned = false;
17167 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
17171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17172 LDKAcceptChannel this_ptr_conv;
17173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17174 this_ptr_conv.is_owned = false;
17175 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
17178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17179 LDKAcceptChannel this_ptr_conv;
17180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17181 this_ptr_conv.is_owned = false;
17182 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17183 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
17187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17188 LDKAcceptChannel this_ptr_conv;
17189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17190 this_ptr_conv.is_owned = false;
17191 LDKPublicKey val_ref;
17192 CHECK((*env)->GetArrayLength(env, val) == 33);
17193 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17194 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
17197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17198 LDKAcceptChannel 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, 33);
17202 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
17206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17207 LDKAcceptChannel this_ptr_conv;
17208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17209 this_ptr_conv.is_owned = false;
17210 LDKPublicKey val_ref;
17211 CHECK((*env)->GetArrayLength(env, val) == 33);
17212 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17213 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
17216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17217 LDKAcceptChannel 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, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
17225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17226 LDKAcceptChannel 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 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
17235 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17236 LDKAcceptChannel this_ptr_conv;
17237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17238 this_ptr_conv.is_owned = false;
17239 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17240 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
17244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17245 LDKAcceptChannel this_ptr_conv;
17246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17247 this_ptr_conv.is_owned = false;
17248 LDKPublicKey val_ref;
17249 CHECK((*env)->GetArrayLength(env, val) == 33);
17250 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17251 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17255 LDKAcceptChannel this_ptr_conv;
17256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17257 this_ptr_conv.is_owned = false;
17258 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17259 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
17263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17264 LDKAcceptChannel this_ptr_conv;
17265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17266 this_ptr_conv.is_owned = false;
17267 LDKPublicKey val_ref;
17268 CHECK((*env)->GetArrayLength(env, val) == 33);
17269 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17270 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
17273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17274 LDKAcceptChannel 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, 33);
17278 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
17282 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) {
17283 LDKAcceptChannel this_ptr_conv;
17284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17285 this_ptr_conv.is_owned = false;
17286 LDKPublicKey val_ref;
17287 CHECK((*env)->GetArrayLength(env, val) == 33);
17288 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17289 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
17292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17293 LDKAcceptChannel orig_conv;
17294 orig_conv.inner = (void*)(orig & (~1));
17295 orig_conv.is_owned = false;
17296 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
17297 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17298 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17299 uint64_t ret_ref = (uint64_t)ret_var.inner;
17300 if (ret_var.is_owned) {
17306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17307 LDKFundingCreated this_obj_conv;
17308 this_obj_conv.inner = (void*)(this_obj & (~1));
17309 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17310 FundingCreated_free(this_obj_conv);
17313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17314 LDKFundingCreated this_ptr_conv;
17315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17316 this_ptr_conv.is_owned = false;
17317 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17318 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
17322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17323 LDKFundingCreated this_ptr_conv;
17324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17325 this_ptr_conv.is_owned = false;
17326 LDKThirtyTwoBytes val_ref;
17327 CHECK((*env)->GetArrayLength(env, val) == 32);
17328 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17329 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
17332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
17333 LDKFundingCreated this_ptr_conv;
17334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17335 this_ptr_conv.is_owned = false;
17336 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17337 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
17341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17342 LDKFundingCreated this_ptr_conv;
17343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17344 this_ptr_conv.is_owned = false;
17345 LDKThirtyTwoBytes val_ref;
17346 CHECK((*env)->GetArrayLength(env, val) == 32);
17347 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17348 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
17351 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
17352 LDKFundingCreated this_ptr_conv;
17353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17354 this_ptr_conv.is_owned = false;
17355 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
17359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17360 LDKFundingCreated this_ptr_conv;
17361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17362 this_ptr_conv.is_owned = false;
17363 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
17366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17367 LDKFundingCreated this_ptr_conv;
17368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17369 this_ptr_conv.is_owned = false;
17370 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17371 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
17375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17376 LDKFundingCreated this_ptr_conv;
17377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17378 this_ptr_conv.is_owned = false;
17379 LDKSignature val_ref;
17380 CHECK((*env)->GetArrayLength(env, val) == 64);
17381 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17382 FundingCreated_set_signature(&this_ptr_conv, val_ref);
17385 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) {
17386 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
17387 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
17388 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
17389 LDKThirtyTwoBytes funding_txid_arg_ref;
17390 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
17391 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
17392 LDKSignature signature_arg_ref;
17393 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17394 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17395 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
17396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17398 uint64_t ret_ref = (uint64_t)ret_var.inner;
17399 if (ret_var.is_owned) {
17405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17406 LDKFundingCreated orig_conv;
17407 orig_conv.inner = (void*)(orig & (~1));
17408 orig_conv.is_owned = false;
17409 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
17410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17412 uint64_t ret_ref = (uint64_t)ret_var.inner;
17413 if (ret_var.is_owned) {
17419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17420 LDKFundingSigned this_obj_conv;
17421 this_obj_conv.inner = (void*)(this_obj & (~1));
17422 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17423 FundingSigned_free(this_obj_conv);
17426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17427 LDKFundingSigned this_ptr_conv;
17428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17429 this_ptr_conv.is_owned = false;
17430 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17431 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
17435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17436 LDKFundingSigned this_ptr_conv;
17437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17438 this_ptr_conv.is_owned = false;
17439 LDKThirtyTwoBytes val_ref;
17440 CHECK((*env)->GetArrayLength(env, val) == 32);
17441 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17442 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17446 LDKFundingSigned this_ptr_conv;
17447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17448 this_ptr_conv.is_owned = false;
17449 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17450 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
17454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17455 LDKFundingSigned this_ptr_conv;
17456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17457 this_ptr_conv.is_owned = false;
17458 LDKSignature val_ref;
17459 CHECK((*env)->GetArrayLength(env, val) == 64);
17460 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17461 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
17465 LDKThirtyTwoBytes channel_id_arg_ref;
17466 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17467 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17468 LDKSignature signature_arg_ref;
17469 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17470 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17471 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17474 uint64_t ret_ref = (uint64_t)ret_var.inner;
17475 if (ret_var.is_owned) {
17481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17482 LDKFundingSigned orig_conv;
17483 orig_conv.inner = (void*)(orig & (~1));
17484 orig_conv.is_owned = false;
17485 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17486 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17487 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17488 uint64_t ret_ref = (uint64_t)ret_var.inner;
17489 if (ret_var.is_owned) {
17495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17496 LDKFundingLocked this_obj_conv;
17497 this_obj_conv.inner = (void*)(this_obj & (~1));
17498 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17499 FundingLocked_free(this_obj_conv);
17502 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17503 LDKFundingLocked this_ptr_conv;
17504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17505 this_ptr_conv.is_owned = false;
17506 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17507 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
17511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17512 LDKFundingLocked this_ptr_conv;
17513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17514 this_ptr_conv.is_owned = false;
17515 LDKThirtyTwoBytes val_ref;
17516 CHECK((*env)->GetArrayLength(env, val) == 32);
17517 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17518 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
17521 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17522 LDKFundingLocked this_ptr_conv;
17523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17524 this_ptr_conv.is_owned = false;
17525 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17526 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
17530 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) {
17531 LDKFundingLocked this_ptr_conv;
17532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17533 this_ptr_conv.is_owned = false;
17534 LDKPublicKey val_ref;
17535 CHECK((*env)->GetArrayLength(env, val) == 33);
17536 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17537 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17540 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) {
17541 LDKThirtyTwoBytes channel_id_arg_ref;
17542 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17543 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17544 LDKPublicKey next_per_commitment_point_arg_ref;
17545 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
17546 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
17547 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
17548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17550 uint64_t ret_ref = (uint64_t)ret_var.inner;
17551 if (ret_var.is_owned) {
17557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17558 LDKFundingLocked orig_conv;
17559 orig_conv.inner = (void*)(orig & (~1));
17560 orig_conv.is_owned = false;
17561 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
17562 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17563 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17564 uint64_t ret_ref = (uint64_t)ret_var.inner;
17565 if (ret_var.is_owned) {
17571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17572 LDKShutdown this_obj_conv;
17573 this_obj_conv.inner = (void*)(this_obj & (~1));
17574 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17575 Shutdown_free(this_obj_conv);
17578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17579 LDKShutdown this_ptr_conv;
17580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17581 this_ptr_conv.is_owned = false;
17582 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17583 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
17587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17588 LDKShutdown this_ptr_conv;
17589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17590 this_ptr_conv.is_owned = false;
17591 LDKThirtyTwoBytes val_ref;
17592 CHECK((*env)->GetArrayLength(env, val) == 32);
17593 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17594 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
17597 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17598 LDKShutdown this_ptr_conv;
17599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17600 this_ptr_conv.is_owned = false;
17601 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
17602 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17603 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17608 LDKShutdown this_ptr_conv;
17609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17610 this_ptr_conv.is_owned = false;
17611 LDKCVec_u8Z val_ref;
17612 val_ref.datalen = (*env)->GetArrayLength(env, val);
17613 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17614 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
17615 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
17618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
17619 LDKThirtyTwoBytes channel_id_arg_ref;
17620 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17621 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17622 LDKCVec_u8Z scriptpubkey_arg_ref;
17623 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
17624 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17625 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
17626 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
17627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17629 uint64_t ret_ref = (uint64_t)ret_var.inner;
17630 if (ret_var.is_owned) {
17636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17637 LDKShutdown orig_conv;
17638 orig_conv.inner = (void*)(orig & (~1));
17639 orig_conv.is_owned = false;
17640 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
17641 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17642 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17643 uint64_t ret_ref = (uint64_t)ret_var.inner;
17644 if (ret_var.is_owned) {
17650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17651 LDKClosingSigned this_obj_conv;
17652 this_obj_conv.inner = (void*)(this_obj & (~1));
17653 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17654 ClosingSigned_free(this_obj_conv);
17657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17658 LDKClosingSigned this_ptr_conv;
17659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17660 this_ptr_conv.is_owned = false;
17661 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17662 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
17666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17667 LDKClosingSigned this_ptr_conv;
17668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17669 this_ptr_conv.is_owned = false;
17670 LDKThirtyTwoBytes val_ref;
17671 CHECK((*env)->GetArrayLength(env, val) == 32);
17672 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17673 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
17676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17677 LDKClosingSigned this_ptr_conv;
17678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17679 this_ptr_conv.is_owned = false;
17680 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
17684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17685 LDKClosingSigned this_ptr_conv;
17686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17687 this_ptr_conv.is_owned = false;
17688 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
17691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17692 LDKClosingSigned this_ptr_conv;
17693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17694 this_ptr_conv.is_owned = false;
17695 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17696 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
17700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17701 LDKClosingSigned this_ptr_conv;
17702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17703 this_ptr_conv.is_owned = false;
17704 LDKSignature val_ref;
17705 CHECK((*env)->GetArrayLength(env, val) == 64);
17706 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17707 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
17710 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) {
17711 LDKThirtyTwoBytes channel_id_arg_ref;
17712 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17713 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17714 LDKSignature signature_arg_ref;
17715 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17716 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17717 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
17718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17720 uint64_t ret_ref = (uint64_t)ret_var.inner;
17721 if (ret_var.is_owned) {
17727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17728 LDKClosingSigned orig_conv;
17729 orig_conv.inner = (void*)(orig & (~1));
17730 orig_conv.is_owned = false;
17731 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
17732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17734 uint64_t ret_ref = (uint64_t)ret_var.inner;
17735 if (ret_var.is_owned) {
17741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17742 LDKUpdateAddHTLC this_obj_conv;
17743 this_obj_conv.inner = (void*)(this_obj & (~1));
17744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17745 UpdateAddHTLC_free(this_obj_conv);
17748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17749 LDKUpdateAddHTLC this_ptr_conv;
17750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17751 this_ptr_conv.is_owned = false;
17752 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17753 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
17757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17758 LDKUpdateAddHTLC this_ptr_conv;
17759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17760 this_ptr_conv.is_owned = false;
17761 LDKThirtyTwoBytes val_ref;
17762 CHECK((*env)->GetArrayLength(env, val) == 32);
17763 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17764 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
17767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17768 LDKUpdateAddHTLC this_ptr_conv;
17769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17770 this_ptr_conv.is_owned = false;
17771 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
17775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17776 LDKUpdateAddHTLC this_ptr_conv;
17777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17778 this_ptr_conv.is_owned = false;
17779 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
17782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17783 LDKUpdateAddHTLC this_ptr_conv;
17784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17785 this_ptr_conv.is_owned = false;
17786 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
17790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17791 LDKUpdateAddHTLC this_ptr_conv;
17792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17793 this_ptr_conv.is_owned = false;
17794 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
17797 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17798 LDKUpdateAddHTLC this_ptr_conv;
17799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17800 this_ptr_conv.is_owned = false;
17801 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17802 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
17806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17807 LDKUpdateAddHTLC this_ptr_conv;
17808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17809 this_ptr_conv.is_owned = false;
17810 LDKThirtyTwoBytes val_ref;
17811 CHECK((*env)->GetArrayLength(env, val) == 32);
17812 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17813 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
17816 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
17817 LDKUpdateAddHTLC this_ptr_conv;
17818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17819 this_ptr_conv.is_owned = false;
17820 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
17824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17825 LDKUpdateAddHTLC this_ptr_conv;
17826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17827 this_ptr_conv.is_owned = false;
17828 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
17831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17832 LDKUpdateAddHTLC orig_conv;
17833 orig_conv.inner = (void*)(orig & (~1));
17834 orig_conv.is_owned = false;
17835 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
17836 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17837 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17838 uint64_t ret_ref = (uint64_t)ret_var.inner;
17839 if (ret_var.is_owned) {
17845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17846 LDKUpdateFulfillHTLC this_obj_conv;
17847 this_obj_conv.inner = (void*)(this_obj & (~1));
17848 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17849 UpdateFulfillHTLC_free(this_obj_conv);
17852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17853 LDKUpdateFulfillHTLC this_ptr_conv;
17854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17855 this_ptr_conv.is_owned = false;
17856 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17857 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
17861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17862 LDKUpdateFulfillHTLC this_ptr_conv;
17863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17864 this_ptr_conv.is_owned = false;
17865 LDKThirtyTwoBytes val_ref;
17866 CHECK((*env)->GetArrayLength(env, val) == 32);
17867 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17868 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
17871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17872 LDKUpdateFulfillHTLC this_ptr_conv;
17873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17874 this_ptr_conv.is_owned = false;
17875 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
17879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17880 LDKUpdateFulfillHTLC this_ptr_conv;
17881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17882 this_ptr_conv.is_owned = false;
17883 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
17886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
17887 LDKUpdateFulfillHTLC this_ptr_conv;
17888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17889 this_ptr_conv.is_owned = false;
17890 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17891 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
17895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17896 LDKUpdateFulfillHTLC this_ptr_conv;
17897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17898 this_ptr_conv.is_owned = false;
17899 LDKThirtyTwoBytes val_ref;
17900 CHECK((*env)->GetArrayLength(env, val) == 32);
17901 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17902 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
17905 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) {
17906 LDKThirtyTwoBytes channel_id_arg_ref;
17907 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17908 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17909 LDKThirtyTwoBytes payment_preimage_arg_ref;
17910 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
17911 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
17912 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
17913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17915 uint64_t ret_ref = (uint64_t)ret_var.inner;
17916 if (ret_var.is_owned) {
17922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17923 LDKUpdateFulfillHTLC orig_conv;
17924 orig_conv.inner = (void*)(orig & (~1));
17925 orig_conv.is_owned = false;
17926 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
17927 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17928 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17929 uint64_t ret_ref = (uint64_t)ret_var.inner;
17930 if (ret_var.is_owned) {
17936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17937 LDKUpdateFailHTLC this_obj_conv;
17938 this_obj_conv.inner = (void*)(this_obj & (~1));
17939 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17940 UpdateFailHTLC_free(this_obj_conv);
17943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17944 LDKUpdateFailHTLC this_ptr_conv;
17945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17946 this_ptr_conv.is_owned = false;
17947 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17948 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
17952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17953 LDKUpdateFailHTLC this_ptr_conv;
17954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17955 this_ptr_conv.is_owned = false;
17956 LDKThirtyTwoBytes val_ref;
17957 CHECK((*env)->GetArrayLength(env, val) == 32);
17958 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17959 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
17962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17963 LDKUpdateFailHTLC this_ptr_conv;
17964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17965 this_ptr_conv.is_owned = false;
17966 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
17970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17971 LDKUpdateFailHTLC this_ptr_conv;
17972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17973 this_ptr_conv.is_owned = false;
17974 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
17977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17978 LDKUpdateFailHTLC orig_conv;
17979 orig_conv.inner = (void*)(orig & (~1));
17980 orig_conv.is_owned = false;
17981 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
17982 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17983 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17984 uint64_t ret_ref = (uint64_t)ret_var.inner;
17985 if (ret_var.is_owned) {
17991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17992 LDKUpdateFailMalformedHTLC this_obj_conv;
17993 this_obj_conv.inner = (void*)(this_obj & (~1));
17994 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17995 UpdateFailMalformedHTLC_free(this_obj_conv);
17998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17999 LDKUpdateFailMalformedHTLC this_ptr_conv;
18000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18001 this_ptr_conv.is_owned = false;
18002 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18003 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
18007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18008 LDKUpdateFailMalformedHTLC this_ptr_conv;
18009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18010 this_ptr_conv.is_owned = false;
18011 LDKThirtyTwoBytes val_ref;
18012 CHECK((*env)->GetArrayLength(env, val) == 32);
18013 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18014 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
18017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18018 LDKUpdateFailMalformedHTLC this_ptr_conv;
18019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18020 this_ptr_conv.is_owned = false;
18021 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
18025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18026 LDKUpdateFailMalformedHTLC this_ptr_conv;
18027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18028 this_ptr_conv.is_owned = false;
18029 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
18032 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
18033 LDKUpdateFailMalformedHTLC this_ptr_conv;
18034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18035 this_ptr_conv.is_owned = false;
18036 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
18040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18041 LDKUpdateFailMalformedHTLC this_ptr_conv;
18042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18043 this_ptr_conv.is_owned = false;
18044 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
18047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18048 LDKUpdateFailMalformedHTLC orig_conv;
18049 orig_conv.inner = (void*)(orig & (~1));
18050 orig_conv.is_owned = false;
18051 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
18052 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18053 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18054 uint64_t ret_ref = (uint64_t)ret_var.inner;
18055 if (ret_var.is_owned) {
18061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18062 LDKCommitmentSigned this_obj_conv;
18063 this_obj_conv.inner = (void*)(this_obj & (~1));
18064 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18065 CommitmentSigned_free(this_obj_conv);
18068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18069 LDKCommitmentSigned this_ptr_conv;
18070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18071 this_ptr_conv.is_owned = false;
18072 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18073 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
18077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18078 LDKCommitmentSigned this_ptr_conv;
18079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18080 this_ptr_conv.is_owned = false;
18081 LDKThirtyTwoBytes val_ref;
18082 CHECK((*env)->GetArrayLength(env, val) == 32);
18083 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18084 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
18087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18088 LDKCommitmentSigned this_ptr_conv;
18089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18090 this_ptr_conv.is_owned = false;
18091 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18092 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
18096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18097 LDKCommitmentSigned this_ptr_conv;
18098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18099 this_ptr_conv.is_owned = false;
18100 LDKSignature val_ref;
18101 CHECK((*env)->GetArrayLength(env, val) == 64);
18102 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18103 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
18106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
18107 LDKCommitmentSigned this_ptr_conv;
18108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18109 this_ptr_conv.is_owned = false;
18110 LDKCVec_SignatureZ val_constr;
18111 val_constr.datalen = (*env)->GetArrayLength(env, val);
18112 if (val_constr.datalen > 0)
18113 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18115 val_constr.data = NULL;
18116 for (size_t i = 0; i < val_constr.datalen; i++) {
18117 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
18118 LDKSignature val_conv_8_ref;
18119 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
18120 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
18121 val_constr.data[i] = val_conv_8_ref;
18123 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
18126 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) {
18127 LDKThirtyTwoBytes channel_id_arg_ref;
18128 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18129 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18130 LDKSignature signature_arg_ref;
18131 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18132 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18133 LDKCVec_SignatureZ htlc_signatures_arg_constr;
18134 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
18135 if (htlc_signatures_arg_constr.datalen > 0)
18136 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18138 htlc_signatures_arg_constr.data = NULL;
18139 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
18140 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
18141 LDKSignature htlc_signatures_arg_conv_8_ref;
18142 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
18143 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
18144 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
18146 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
18147 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18148 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18149 uint64_t ret_ref = (uint64_t)ret_var.inner;
18150 if (ret_var.is_owned) {
18156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18157 LDKCommitmentSigned orig_conv;
18158 orig_conv.inner = (void*)(orig & (~1));
18159 orig_conv.is_owned = false;
18160 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
18161 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18162 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18163 uint64_t ret_ref = (uint64_t)ret_var.inner;
18164 if (ret_var.is_owned) {
18170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18171 LDKRevokeAndACK this_obj_conv;
18172 this_obj_conv.inner = (void*)(this_obj & (~1));
18173 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18174 RevokeAndACK_free(this_obj_conv);
18177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18178 LDKRevokeAndACK this_ptr_conv;
18179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18180 this_ptr_conv.is_owned = false;
18181 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18182 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
18186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18187 LDKRevokeAndACK this_ptr_conv;
18188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18189 this_ptr_conv.is_owned = false;
18190 LDKThirtyTwoBytes val_ref;
18191 CHECK((*env)->GetArrayLength(env, val) == 32);
18192 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18193 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
18196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
18197 LDKRevokeAndACK this_ptr_conv;
18198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18199 this_ptr_conv.is_owned = false;
18200 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18201 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
18205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18206 LDKRevokeAndACK this_ptr_conv;
18207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18208 this_ptr_conv.is_owned = false;
18209 LDKThirtyTwoBytes val_ref;
18210 CHECK((*env)->GetArrayLength(env, val) == 32);
18211 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18212 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
18215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18216 LDKRevokeAndACK this_ptr_conv;
18217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18218 this_ptr_conv.is_owned = false;
18219 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18220 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
18224 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) {
18225 LDKRevokeAndACK this_ptr_conv;
18226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18227 this_ptr_conv.is_owned = false;
18228 LDKPublicKey val_ref;
18229 CHECK((*env)->GetArrayLength(env, val) == 33);
18230 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18231 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
18234 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) {
18235 LDKThirtyTwoBytes channel_id_arg_ref;
18236 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18237 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18238 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
18239 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
18240 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
18241 LDKPublicKey next_per_commitment_point_arg_ref;
18242 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
18243 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
18244 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
18245 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18246 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18247 uint64_t ret_ref = (uint64_t)ret_var.inner;
18248 if (ret_var.is_owned) {
18254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18255 LDKRevokeAndACK orig_conv;
18256 orig_conv.inner = (void*)(orig & (~1));
18257 orig_conv.is_owned = false;
18258 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
18259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18261 uint64_t ret_ref = (uint64_t)ret_var.inner;
18262 if (ret_var.is_owned) {
18268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18269 LDKUpdateFee this_obj_conv;
18270 this_obj_conv.inner = (void*)(this_obj & (~1));
18271 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18272 UpdateFee_free(this_obj_conv);
18275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18276 LDKUpdateFee this_ptr_conv;
18277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18278 this_ptr_conv.is_owned = false;
18279 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18280 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
18284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18285 LDKUpdateFee this_ptr_conv;
18286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18287 this_ptr_conv.is_owned = false;
18288 LDKThirtyTwoBytes val_ref;
18289 CHECK((*env)->GetArrayLength(env, val) == 32);
18290 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18291 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
18294 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
18295 LDKUpdateFee this_ptr_conv;
18296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18297 this_ptr_conv.is_owned = false;
18298 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
18302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18303 LDKUpdateFee this_ptr_conv;
18304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18305 this_ptr_conv.is_owned = false;
18306 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
18309 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) {
18310 LDKThirtyTwoBytes channel_id_arg_ref;
18311 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18312 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18313 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
18314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18316 uint64_t ret_ref = (uint64_t)ret_var.inner;
18317 if (ret_var.is_owned) {
18323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18324 LDKUpdateFee orig_conv;
18325 orig_conv.inner = (void*)(orig & (~1));
18326 orig_conv.is_owned = false;
18327 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18328 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18329 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18330 uint64_t ret_ref = (uint64_t)ret_var.inner;
18331 if (ret_var.is_owned) {
18337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18338 LDKDataLossProtect this_obj_conv;
18339 this_obj_conv.inner = (void*)(this_obj & (~1));
18340 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18341 DataLossProtect_free(this_obj_conv);
18344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
18345 LDKDataLossProtect this_ptr_conv;
18346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18347 this_ptr_conv.is_owned = false;
18348 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18349 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
18353 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) {
18354 LDKDataLossProtect this_ptr_conv;
18355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18356 this_ptr_conv.is_owned = false;
18357 LDKThirtyTwoBytes val_ref;
18358 CHECK((*env)->GetArrayLength(env, val) == 32);
18359 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18360 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18364 LDKDataLossProtect this_ptr_conv;
18365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18366 this_ptr_conv.is_owned = false;
18367 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18368 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
18372 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) {
18373 LDKDataLossProtect this_ptr_conv;
18374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18375 this_ptr_conv.is_owned = false;
18376 LDKPublicKey val_ref;
18377 CHECK((*env)->GetArrayLength(env, val) == 33);
18378 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18379 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18382 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) {
18383 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18384 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
18385 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
18386 LDKPublicKey my_current_per_commitment_point_arg_ref;
18387 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
18388 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
18389 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18392 uint64_t ret_ref = (uint64_t)ret_var.inner;
18393 if (ret_var.is_owned) {
18399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18400 LDKDataLossProtect orig_conv;
18401 orig_conv.inner = (void*)(orig & (~1));
18402 orig_conv.is_owned = false;
18403 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18406 uint64_t ret_ref = (uint64_t)ret_var.inner;
18407 if (ret_var.is_owned) {
18413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18414 LDKChannelReestablish this_obj_conv;
18415 this_obj_conv.inner = (void*)(this_obj & (~1));
18416 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18417 ChannelReestablish_free(this_obj_conv);
18420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18421 LDKChannelReestablish 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, *ChannelReestablish_get_channel_id(&this_ptr_conv));
18429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18430 LDKChannelReestablish 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 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18440 LDKChannelReestablish this_ptr_conv;
18441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18442 this_ptr_conv.is_owned = false;
18443 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18447 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) {
18448 LDKChannelReestablish this_ptr_conv;
18449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18450 this_ptr_conv.is_owned = false;
18451 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18455 LDKChannelReestablish this_ptr_conv;
18456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18457 this_ptr_conv.is_owned = false;
18458 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18462 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) {
18463 LDKChannelReestablish this_ptr_conv;
18464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18465 this_ptr_conv.is_owned = false;
18466 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18470 LDKChannelReestablish orig_conv;
18471 orig_conv.inner = (void*)(orig & (~1));
18472 orig_conv.is_owned = false;
18473 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18474 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18475 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18476 uint64_t ret_ref = (uint64_t)ret_var.inner;
18477 if (ret_var.is_owned) {
18483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18484 LDKAnnouncementSignatures this_obj_conv;
18485 this_obj_conv.inner = (void*)(this_obj & (~1));
18486 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18487 AnnouncementSignatures_free(this_obj_conv);
18490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18491 LDKAnnouncementSignatures this_ptr_conv;
18492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18493 this_ptr_conv.is_owned = false;
18494 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18495 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
18499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18500 LDKAnnouncementSignatures this_ptr_conv;
18501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18502 this_ptr_conv.is_owned = false;
18503 LDKThirtyTwoBytes val_ref;
18504 CHECK((*env)->GetArrayLength(env, val) == 32);
18505 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18506 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
18509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18510 LDKAnnouncementSignatures this_ptr_conv;
18511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18512 this_ptr_conv.is_owned = false;
18513 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
18517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18518 LDKAnnouncementSignatures this_ptr_conv;
18519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18520 this_ptr_conv.is_owned = false;
18521 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
18524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18525 LDKAnnouncementSignatures this_ptr_conv;
18526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18527 this_ptr_conv.is_owned = false;
18528 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18529 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
18533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18534 LDKAnnouncementSignatures this_ptr_conv;
18535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18536 this_ptr_conv.is_owned = false;
18537 LDKSignature val_ref;
18538 CHECK((*env)->GetArrayLength(env, val) == 64);
18539 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18540 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
18543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18544 LDKAnnouncementSignatures this_ptr_conv;
18545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18546 this_ptr_conv.is_owned = false;
18547 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18548 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
18552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18553 LDKAnnouncementSignatures this_ptr_conv;
18554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18555 this_ptr_conv.is_owned = false;
18556 LDKSignature val_ref;
18557 CHECK((*env)->GetArrayLength(env, val) == 64);
18558 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18559 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
18562 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) {
18563 LDKThirtyTwoBytes channel_id_arg_ref;
18564 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18565 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18566 LDKSignature node_signature_arg_ref;
18567 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
18568 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
18569 LDKSignature bitcoin_signature_arg_ref;
18570 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
18571 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
18572 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
18573 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18574 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18575 uint64_t ret_ref = (uint64_t)ret_var.inner;
18576 if (ret_var.is_owned) {
18582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18583 LDKAnnouncementSignatures orig_conv;
18584 orig_conv.inner = (void*)(orig & (~1));
18585 orig_conv.is_owned = false;
18586 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
18587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18589 uint64_t ret_ref = (uint64_t)ret_var.inner;
18590 if (ret_var.is_owned) {
18596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18597 if ((this_ptr & 1) != 0) return;
18598 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
18599 FREE((void*)this_ptr);
18600 NetAddress_free(this_ptr_conv);
18603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18604 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
18605 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18606 *ret_copy = NetAddress_clone(orig_conv);
18607 uint64_t ret_ref = (uint64_t)ret_copy;
18611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
18612 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
18613 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
18614 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18615 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18616 CVec_u8Z_free(ret_var);
18620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18621 LDKu8slice ser_ref;
18622 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18623 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18624 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
18625 *ret_conv = Result_read(ser_ref);
18626 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18627 return (uint64_t)ret_conv;
18630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18631 LDKu8slice ser_ref;
18632 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18633 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18634 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18635 *ret_conv = NetAddress_read(ser_ref);
18636 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18637 return (uint64_t)ret_conv;
18640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18641 LDKUnsignedNodeAnnouncement this_obj_conv;
18642 this_obj_conv.inner = (void*)(this_obj & (~1));
18643 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18644 UnsignedNodeAnnouncement_free(this_obj_conv);
18647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18648 LDKUnsignedNodeAnnouncement this_ptr_conv;
18649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18650 this_ptr_conv.is_owned = false;
18651 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
18652 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18653 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18654 uint64_t ret_ref = (uint64_t)ret_var.inner;
18655 if (ret_var.is_owned) {
18661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18662 LDKUnsignedNodeAnnouncement this_ptr_conv;
18663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18664 this_ptr_conv.is_owned = false;
18665 LDKNodeFeatures val_conv;
18666 val_conv.inner = (void*)(val & (~1));
18667 val_conv.is_owned = (val & 1) || (val == 0);
18668 val_conv = NodeFeatures_clone(&val_conv);
18669 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
18672 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
18673 LDKUnsignedNodeAnnouncement this_ptr_conv;
18674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18675 this_ptr_conv.is_owned = false;
18676 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
18680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18681 LDKUnsignedNodeAnnouncement this_ptr_conv;
18682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18683 this_ptr_conv.is_owned = false;
18684 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
18687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18688 LDKUnsignedNodeAnnouncement this_ptr_conv;
18689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18690 this_ptr_conv.is_owned = false;
18691 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18692 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
18696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18697 LDKUnsignedNodeAnnouncement this_ptr_conv;
18698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18699 this_ptr_conv.is_owned = false;
18700 LDKPublicKey val_ref;
18701 CHECK((*env)->GetArrayLength(env, val) == 33);
18702 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18703 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
18706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
18707 LDKUnsignedNodeAnnouncement this_ptr_conv;
18708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18709 this_ptr_conv.is_owned = false;
18710 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
18711 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
18715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18716 LDKUnsignedNodeAnnouncement this_ptr_conv;
18717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18718 this_ptr_conv.is_owned = false;
18719 LDKThreeBytes val_ref;
18720 CHECK((*env)->GetArrayLength(env, val) == 3);
18721 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
18722 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
18725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
18726 LDKUnsignedNodeAnnouncement this_ptr_conv;
18727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18728 this_ptr_conv.is_owned = false;
18729 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18730 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
18734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18735 LDKUnsignedNodeAnnouncement this_ptr_conv;
18736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18737 this_ptr_conv.is_owned = false;
18738 LDKThirtyTwoBytes val_ref;
18739 CHECK((*env)->GetArrayLength(env, val) == 32);
18740 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18741 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
18744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
18745 LDKUnsignedNodeAnnouncement this_ptr_conv;
18746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18747 this_ptr_conv.is_owned = false;
18748 LDKCVec_NetAddressZ val_constr;
18749 val_constr.datalen = (*env)->GetArrayLength(env, val);
18750 if (val_constr.datalen > 0)
18751 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18753 val_constr.data = NULL;
18754 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
18755 for (size_t m = 0; m < val_constr.datalen; m++) {
18756 int64_t val_conv_12 = val_vals[m];
18757 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18758 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
18759 val_constr.data[m] = val_conv_12_conv;
18761 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
18762 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
18765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18766 LDKUnsignedNodeAnnouncement orig_conv;
18767 orig_conv.inner = (void*)(orig & (~1));
18768 orig_conv.is_owned = false;
18769 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
18770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18772 uint64_t ret_ref = (uint64_t)ret_var.inner;
18773 if (ret_var.is_owned) {
18779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18780 LDKNodeAnnouncement this_obj_conv;
18781 this_obj_conv.inner = (void*)(this_obj & (~1));
18782 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18783 NodeAnnouncement_free(this_obj_conv);
18786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18787 LDKNodeAnnouncement this_ptr_conv;
18788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18789 this_ptr_conv.is_owned = false;
18790 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18791 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
18795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18796 LDKNodeAnnouncement this_ptr_conv;
18797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18798 this_ptr_conv.is_owned = false;
18799 LDKSignature val_ref;
18800 CHECK((*env)->GetArrayLength(env, val) == 64);
18801 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18802 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
18805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
18806 LDKNodeAnnouncement this_ptr_conv;
18807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18808 this_ptr_conv.is_owned = false;
18809 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
18810 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18811 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18812 uint64_t ret_ref = (uint64_t)ret_var.inner;
18813 if (ret_var.is_owned) {
18819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18820 LDKNodeAnnouncement this_ptr_conv;
18821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18822 this_ptr_conv.is_owned = false;
18823 LDKUnsignedNodeAnnouncement val_conv;
18824 val_conv.inner = (void*)(val & (~1));
18825 val_conv.is_owned = (val & 1) || (val == 0);
18826 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
18827 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
18830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
18831 LDKSignature signature_arg_ref;
18832 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18833 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18834 LDKUnsignedNodeAnnouncement 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 = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
18838 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_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_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18849 LDKNodeAnnouncement orig_conv;
18850 orig_conv.inner = (void*)(orig & (~1));
18851 orig_conv.is_owned = false;
18852 LDKNodeAnnouncement ret_var = NodeAnnouncement_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_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18863 LDKUnsignedChannelAnnouncement 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 UnsignedChannelAnnouncement_free(this_obj_conv);
18869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18870 LDKUnsignedChannelAnnouncement this_ptr_conv;
18871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18872 this_ptr_conv.is_owned = false;
18873 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
18874 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18875 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18876 uint64_t ret_ref = (uint64_t)ret_var.inner;
18877 if (ret_var.is_owned) {
18883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18884 LDKUnsignedChannelAnnouncement this_ptr_conv;
18885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18886 this_ptr_conv.is_owned = false;
18887 LDKChannelFeatures val_conv;
18888 val_conv.inner = (void*)(val & (~1));
18889 val_conv.is_owned = (val & 1) || (val == 0);
18890 val_conv = ChannelFeatures_clone(&val_conv);
18891 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
18894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18895 LDKUnsignedChannelAnnouncement this_ptr_conv;
18896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18897 this_ptr_conv.is_owned = false;
18898 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18899 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
18903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18904 LDKUnsignedChannelAnnouncement this_ptr_conv;
18905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18906 this_ptr_conv.is_owned = false;
18907 LDKThirtyTwoBytes val_ref;
18908 CHECK((*env)->GetArrayLength(env, val) == 32);
18909 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18910 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
18913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18914 LDKUnsignedChannelAnnouncement this_ptr_conv;
18915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18916 this_ptr_conv.is_owned = false;
18917 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
18921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18922 LDKUnsignedChannelAnnouncement this_ptr_conv;
18923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18924 this_ptr_conv.is_owned = false;
18925 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
18928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18929 LDKUnsignedChannelAnnouncement this_ptr_conv;
18930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18931 this_ptr_conv.is_owned = false;
18932 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18933 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
18937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18938 LDKUnsignedChannelAnnouncement this_ptr_conv;
18939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18940 this_ptr_conv.is_owned = false;
18941 LDKPublicKey val_ref;
18942 CHECK((*env)->GetArrayLength(env, val) == 33);
18943 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18944 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
18947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18948 LDKUnsignedChannelAnnouncement this_ptr_conv;
18949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18950 this_ptr_conv.is_owned = false;
18951 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18952 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
18956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18957 LDKUnsignedChannelAnnouncement this_ptr_conv;
18958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18959 this_ptr_conv.is_owned = false;
18960 LDKPublicKey val_ref;
18961 CHECK((*env)->GetArrayLength(env, val) == 33);
18962 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18963 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
18966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18967 LDKUnsignedChannelAnnouncement this_ptr_conv;
18968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18969 this_ptr_conv.is_owned = false;
18970 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18971 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
18975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18976 LDKUnsignedChannelAnnouncement this_ptr_conv;
18977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18978 this_ptr_conv.is_owned = false;
18979 LDKPublicKey val_ref;
18980 CHECK((*env)->GetArrayLength(env, val) == 33);
18981 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18982 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
18985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18986 LDKUnsignedChannelAnnouncement this_ptr_conv;
18987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18988 this_ptr_conv.is_owned = false;
18989 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18990 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
18994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18995 LDKUnsignedChannelAnnouncement this_ptr_conv;
18996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18997 this_ptr_conv.is_owned = false;
18998 LDKPublicKey val_ref;
18999 CHECK((*env)->GetArrayLength(env, val) == 33);
19000 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19001 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
19004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19005 LDKUnsignedChannelAnnouncement orig_conv;
19006 orig_conv.inner = (void*)(orig & (~1));
19007 orig_conv.is_owned = false;
19008 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
19009 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19010 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19011 uint64_t ret_ref = (uint64_t)ret_var.inner;
19012 if (ret_var.is_owned) {
19018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19019 LDKChannelAnnouncement this_obj_conv;
19020 this_obj_conv.inner = (void*)(this_obj & (~1));
19021 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19022 ChannelAnnouncement_free(this_obj_conv);
19025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
19026 LDKChannelAnnouncement this_ptr_conv;
19027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19028 this_ptr_conv.is_owned = false;
19029 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19030 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
19034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19035 LDKChannelAnnouncement this_ptr_conv;
19036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19037 this_ptr_conv.is_owned = false;
19038 LDKSignature val_ref;
19039 CHECK((*env)->GetArrayLength(env, val) == 64);
19040 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19041 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
19044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
19045 LDKChannelAnnouncement this_ptr_conv;
19046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19047 this_ptr_conv.is_owned = false;
19048 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19049 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
19053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19054 LDKChannelAnnouncement this_ptr_conv;
19055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19056 this_ptr_conv.is_owned = false;
19057 LDKSignature val_ref;
19058 CHECK((*env)->GetArrayLength(env, val) == 64);
19059 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19060 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
19063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
19064 LDKChannelAnnouncement this_ptr_conv;
19065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19066 this_ptr_conv.is_owned = false;
19067 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19068 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
19072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19073 LDKChannelAnnouncement this_ptr_conv;
19074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19075 this_ptr_conv.is_owned = false;
19076 LDKSignature val_ref;
19077 CHECK((*env)->GetArrayLength(env, val) == 64);
19078 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19079 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
19082 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
19083 LDKChannelAnnouncement this_ptr_conv;
19084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19085 this_ptr_conv.is_owned = false;
19086 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19087 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
19091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19092 LDKChannelAnnouncement this_ptr_conv;
19093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19094 this_ptr_conv.is_owned = false;
19095 LDKSignature val_ref;
19096 CHECK((*env)->GetArrayLength(env, val) == 64);
19097 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19098 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
19101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19102 LDKChannelAnnouncement this_ptr_conv;
19103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19104 this_ptr_conv.is_owned = false;
19105 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
19106 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19107 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19108 uint64_t ret_ref = (uint64_t)ret_var.inner;
19109 if (ret_var.is_owned) {
19115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19116 LDKChannelAnnouncement this_ptr_conv;
19117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19118 this_ptr_conv.is_owned = false;
19119 LDKUnsignedChannelAnnouncement val_conv;
19120 val_conv.inner = (void*)(val & (~1));
19121 val_conv.is_owned = (val & 1) || (val == 0);
19122 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
19123 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
19126 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) {
19127 LDKSignature node_signature_1_arg_ref;
19128 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
19129 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
19130 LDKSignature node_signature_2_arg_ref;
19131 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
19132 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
19133 LDKSignature bitcoin_signature_1_arg_ref;
19134 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
19135 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
19136 LDKSignature bitcoin_signature_2_arg_ref;
19137 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
19138 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
19139 LDKUnsignedChannelAnnouncement contents_arg_conv;
19140 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19141 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19142 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
19143 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);
19144 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19145 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19146 uint64_t ret_ref = (uint64_t)ret_var.inner;
19147 if (ret_var.is_owned) {
19153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19154 LDKChannelAnnouncement orig_conv;
19155 orig_conv.inner = (void*)(orig & (~1));
19156 orig_conv.is_owned = false;
19157 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
19158 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19159 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19160 uint64_t ret_ref = (uint64_t)ret_var.inner;
19161 if (ret_var.is_owned) {
19167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19168 LDKUnsignedChannelUpdate this_obj_conv;
19169 this_obj_conv.inner = (void*)(this_obj & (~1));
19170 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19171 UnsignedChannelUpdate_free(this_obj_conv);
19174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19175 LDKUnsignedChannelUpdate this_ptr_conv;
19176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19177 this_ptr_conv.is_owned = false;
19178 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19179 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
19183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19184 LDKUnsignedChannelUpdate this_ptr_conv;
19185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19186 this_ptr_conv.is_owned = false;
19187 LDKThirtyTwoBytes val_ref;
19188 CHECK((*env)->GetArrayLength(env, val) == 32);
19189 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19190 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
19193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19194 LDKUnsignedChannelUpdate this_ptr_conv;
19195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19196 this_ptr_conv.is_owned = false;
19197 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
19201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19202 LDKUnsignedChannelUpdate this_ptr_conv;
19203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19204 this_ptr_conv.is_owned = false;
19205 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
19208 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
19209 LDKUnsignedChannelUpdate this_ptr_conv;
19210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19211 this_ptr_conv.is_owned = false;
19212 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
19216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19217 LDKUnsignedChannelUpdate this_ptr_conv;
19218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19219 this_ptr_conv.is_owned = false;
19220 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
19223 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
19224 LDKUnsignedChannelUpdate this_ptr_conv;
19225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19226 this_ptr_conv.is_owned = false;
19227 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
19231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
19232 LDKUnsignedChannelUpdate this_ptr_conv;
19233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19234 this_ptr_conv.is_owned = false;
19235 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
19238 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19239 LDKUnsignedChannelUpdate this_ptr_conv;
19240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19241 this_ptr_conv.is_owned = false;
19242 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
19246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19247 LDKUnsignedChannelUpdate this_ptr_conv;
19248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19249 this_ptr_conv.is_owned = false;
19250 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
19253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19254 LDKUnsignedChannelUpdate this_ptr_conv;
19255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19256 this_ptr_conv.is_owned = false;
19257 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
19261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19262 LDKUnsignedChannelUpdate this_ptr_conv;
19263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19264 this_ptr_conv.is_owned = false;
19265 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
19268 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19269 LDKUnsignedChannelUpdate this_ptr_conv;
19270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19271 this_ptr_conv.is_owned = false;
19272 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
19276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19277 LDKUnsignedChannelUpdate this_ptr_conv;
19278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19279 this_ptr_conv.is_owned = false;
19280 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
19283 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
19284 LDKUnsignedChannelUpdate this_ptr_conv;
19285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19286 this_ptr_conv.is_owned = false;
19287 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
19291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19292 LDKUnsignedChannelUpdate this_ptr_conv;
19293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19294 this_ptr_conv.is_owned = false;
19295 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
19298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19299 LDKUnsignedChannelUpdate orig_conv;
19300 orig_conv.inner = (void*)(orig & (~1));
19301 orig_conv.is_owned = false;
19302 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
19303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19305 uint64_t ret_ref = (uint64_t)ret_var.inner;
19306 if (ret_var.is_owned) {
19312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19313 LDKChannelUpdate this_obj_conv;
19314 this_obj_conv.inner = (void*)(this_obj & (~1));
19315 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19316 ChannelUpdate_free(this_obj_conv);
19319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19320 LDKChannelUpdate this_ptr_conv;
19321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19322 this_ptr_conv.is_owned = false;
19323 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19324 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
19328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19329 LDKChannelUpdate this_ptr_conv;
19330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19331 this_ptr_conv.is_owned = false;
19332 LDKSignature val_ref;
19333 CHECK((*env)->GetArrayLength(env, val) == 64);
19334 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19335 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19339 LDKChannelUpdate this_ptr_conv;
19340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19341 this_ptr_conv.is_owned = false;
19342 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19343 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19344 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19345 uint64_t ret_ref = (uint64_t)ret_var.inner;
19346 if (ret_var.is_owned) {
19352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19353 LDKChannelUpdate this_ptr_conv;
19354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19355 this_ptr_conv.is_owned = false;
19356 LDKUnsignedChannelUpdate val_conv;
19357 val_conv.inner = (void*)(val & (~1));
19358 val_conv.is_owned = (val & 1) || (val == 0);
19359 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19360 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
19364 LDKSignature signature_arg_ref;
19365 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19366 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19367 LDKUnsignedChannelUpdate contents_arg_conv;
19368 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19369 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19370 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19371 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19374 uint64_t ret_ref = (uint64_t)ret_var.inner;
19375 if (ret_var.is_owned) {
19381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19382 LDKChannelUpdate orig_conv;
19383 orig_conv.inner = (void*)(orig & (~1));
19384 orig_conv.is_owned = false;
19385 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19386 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19387 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19388 uint64_t ret_ref = (uint64_t)ret_var.inner;
19389 if (ret_var.is_owned) {
19395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19396 LDKQueryChannelRange this_obj_conv;
19397 this_obj_conv.inner = (void*)(this_obj & (~1));
19398 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19399 QueryChannelRange_free(this_obj_conv);
19402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19403 LDKQueryChannelRange this_ptr_conv;
19404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19405 this_ptr_conv.is_owned = false;
19406 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19407 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
19411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19412 LDKQueryChannelRange this_ptr_conv;
19413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19414 this_ptr_conv.is_owned = false;
19415 LDKThirtyTwoBytes val_ref;
19416 CHECK((*env)->GetArrayLength(env, val) == 32);
19417 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19418 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19421 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19422 LDKQueryChannelRange this_ptr_conv;
19423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19424 this_ptr_conv.is_owned = false;
19425 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19430 LDKQueryChannelRange this_ptr_conv;
19431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19432 this_ptr_conv.is_owned = false;
19433 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19436 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19437 LDKQueryChannelRange this_ptr_conv;
19438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19439 this_ptr_conv.is_owned = false;
19440 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19445 LDKQueryChannelRange this_ptr_conv;
19446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19447 this_ptr_conv.is_owned = false;
19448 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19451 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) {
19452 LDKThirtyTwoBytes chain_hash_arg_ref;
19453 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19454 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19455 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19458 uint64_t ret_ref = (uint64_t)ret_var.inner;
19459 if (ret_var.is_owned) {
19465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19466 LDKQueryChannelRange orig_conv;
19467 orig_conv.inner = (void*)(orig & (~1));
19468 orig_conv.is_owned = false;
19469 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19470 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19471 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19472 uint64_t ret_ref = (uint64_t)ret_var.inner;
19473 if (ret_var.is_owned) {
19479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19480 LDKReplyChannelRange this_obj_conv;
19481 this_obj_conv.inner = (void*)(this_obj & (~1));
19482 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19483 ReplyChannelRange_free(this_obj_conv);
19486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19487 LDKReplyChannelRange this_ptr_conv;
19488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19489 this_ptr_conv.is_owned = false;
19490 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19491 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
19495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19496 LDKReplyChannelRange this_ptr_conv;
19497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19498 this_ptr_conv.is_owned = false;
19499 LDKThirtyTwoBytes val_ref;
19500 CHECK((*env)->GetArrayLength(env, val) == 32);
19501 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19502 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19505 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19506 LDKReplyChannelRange this_ptr_conv;
19507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19508 this_ptr_conv.is_owned = false;
19509 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
19513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19514 LDKReplyChannelRange this_ptr_conv;
19515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19516 this_ptr_conv.is_owned = false;
19517 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
19520 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19521 LDKReplyChannelRange this_ptr_conv;
19522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19523 this_ptr_conv.is_owned = false;
19524 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
19528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19529 LDKReplyChannelRange this_ptr_conv;
19530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19531 this_ptr_conv.is_owned = false;
19532 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
19536 LDKReplyChannelRange this_ptr_conv;
19537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19538 this_ptr_conv.is_owned = false;
19539 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
19543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19544 LDKReplyChannelRange this_ptr_conv;
19545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19546 this_ptr_conv.is_owned = false;
19547 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
19550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19551 LDKReplyChannelRange this_ptr_conv;
19552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19553 this_ptr_conv.is_owned = false;
19554 LDKCVec_u64Z val_constr;
19555 val_constr.datalen = (*env)->GetArrayLength(env, val);
19556 if (val_constr.datalen > 0)
19557 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19559 val_constr.data = NULL;
19560 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19561 for (size_t g = 0; g < val_constr.datalen; g++) {
19562 int64_t val_conv_6 = val_vals[g];
19563 val_constr.data[g] = val_conv_6;
19565 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19566 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
19569 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) {
19570 LDKThirtyTwoBytes chain_hash_arg_ref;
19571 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19572 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19573 LDKCVec_u64Z short_channel_ids_arg_constr;
19574 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19575 if (short_channel_ids_arg_constr.datalen > 0)
19576 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19578 short_channel_ids_arg_constr.data = NULL;
19579 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19580 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19581 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19582 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19584 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19585 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
19586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19588 uint64_t ret_ref = (uint64_t)ret_var.inner;
19589 if (ret_var.is_owned) {
19595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19596 LDKReplyChannelRange orig_conv;
19597 orig_conv.inner = (void*)(orig & (~1));
19598 orig_conv.is_owned = false;
19599 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
19600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19602 uint64_t ret_ref = (uint64_t)ret_var.inner;
19603 if (ret_var.is_owned) {
19609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19610 LDKQueryShortChannelIds this_obj_conv;
19611 this_obj_conv.inner = (void*)(this_obj & (~1));
19612 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19613 QueryShortChannelIds_free(this_obj_conv);
19616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19617 LDKQueryShortChannelIds this_ptr_conv;
19618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19619 this_ptr_conv.is_owned = false;
19620 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19621 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
19625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19626 LDKQueryShortChannelIds this_ptr_conv;
19627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19628 this_ptr_conv.is_owned = false;
19629 LDKThirtyTwoBytes val_ref;
19630 CHECK((*env)->GetArrayLength(env, val) == 32);
19631 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19632 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
19635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19636 LDKQueryShortChannelIds this_ptr_conv;
19637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19638 this_ptr_conv.is_owned = false;
19639 LDKCVec_u64Z val_constr;
19640 val_constr.datalen = (*env)->GetArrayLength(env, val);
19641 if (val_constr.datalen > 0)
19642 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19644 val_constr.data = NULL;
19645 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19646 for (size_t g = 0; g < val_constr.datalen; g++) {
19647 int64_t val_conv_6 = val_vals[g];
19648 val_constr.data[g] = val_conv_6;
19650 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19651 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
19654 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) {
19655 LDKThirtyTwoBytes chain_hash_arg_ref;
19656 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19657 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19658 LDKCVec_u64Z short_channel_ids_arg_constr;
19659 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19660 if (short_channel_ids_arg_constr.datalen > 0)
19661 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19663 short_channel_ids_arg_constr.data = NULL;
19664 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19665 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19666 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19667 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19669 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19670 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
19671 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19672 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19673 uint64_t ret_ref = (uint64_t)ret_var.inner;
19674 if (ret_var.is_owned) {
19680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19681 LDKQueryShortChannelIds orig_conv;
19682 orig_conv.inner = (void*)(orig & (~1));
19683 orig_conv.is_owned = false;
19684 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
19685 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19686 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19687 uint64_t ret_ref = (uint64_t)ret_var.inner;
19688 if (ret_var.is_owned) {
19694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19695 LDKReplyShortChannelIdsEnd this_obj_conv;
19696 this_obj_conv.inner = (void*)(this_obj & (~1));
19697 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19698 ReplyShortChannelIdsEnd_free(this_obj_conv);
19701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19702 LDKReplyShortChannelIdsEnd this_ptr_conv;
19703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19704 this_ptr_conv.is_owned = false;
19705 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19706 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
19710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19711 LDKReplyShortChannelIdsEnd this_ptr_conv;
19712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19713 this_ptr_conv.is_owned = false;
19714 LDKThirtyTwoBytes val_ref;
19715 CHECK((*env)->GetArrayLength(env, val) == 32);
19716 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19717 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
19720 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
19721 LDKReplyShortChannelIdsEnd this_ptr_conv;
19722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19723 this_ptr_conv.is_owned = false;
19724 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
19728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19729 LDKReplyShortChannelIdsEnd this_ptr_conv;
19730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19731 this_ptr_conv.is_owned = false;
19732 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
19735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
19736 LDKThirtyTwoBytes chain_hash_arg_ref;
19737 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19738 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19739 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
19740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19742 uint64_t ret_ref = (uint64_t)ret_var.inner;
19743 if (ret_var.is_owned) {
19749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19750 LDKReplyShortChannelIdsEnd orig_conv;
19751 orig_conv.inner = (void*)(orig & (~1));
19752 orig_conv.is_owned = false;
19753 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
19754 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19755 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19756 uint64_t ret_ref = (uint64_t)ret_var.inner;
19757 if (ret_var.is_owned) {
19763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19764 LDKGossipTimestampFilter this_obj_conv;
19765 this_obj_conv.inner = (void*)(this_obj & (~1));
19766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19767 GossipTimestampFilter_free(this_obj_conv);
19770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19771 LDKGossipTimestampFilter this_ptr_conv;
19772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19773 this_ptr_conv.is_owned = false;
19774 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19775 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
19779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19780 LDKGossipTimestampFilter this_ptr_conv;
19781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19782 this_ptr_conv.is_owned = false;
19783 LDKThirtyTwoBytes val_ref;
19784 CHECK((*env)->GetArrayLength(env, val) == 32);
19785 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19786 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
19789 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
19790 LDKGossipTimestampFilter this_ptr_conv;
19791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19792 this_ptr_conv.is_owned = false;
19793 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
19797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19798 LDKGossipTimestampFilter this_ptr_conv;
19799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19800 this_ptr_conv.is_owned = false;
19801 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
19804 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
19805 LDKGossipTimestampFilter this_ptr_conv;
19806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19807 this_ptr_conv.is_owned = false;
19808 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
19812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19813 LDKGossipTimestampFilter this_ptr_conv;
19814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19815 this_ptr_conv.is_owned = false;
19816 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
19819 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) {
19820 LDKThirtyTwoBytes chain_hash_arg_ref;
19821 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19822 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19823 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
19824 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19825 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19826 uint64_t ret_ref = (uint64_t)ret_var.inner;
19827 if (ret_var.is_owned) {
19833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19834 LDKGossipTimestampFilter orig_conv;
19835 orig_conv.inner = (void*)(orig & (~1));
19836 orig_conv.is_owned = false;
19837 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
19838 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19839 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19840 uint64_t ret_ref = (uint64_t)ret_var.inner;
19841 if (ret_var.is_owned) {
19847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19848 if ((this_ptr & 1) != 0) return;
19849 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
19850 FREE((void*)this_ptr);
19851 ErrorAction_free(this_ptr_conv);
19854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19855 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
19856 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19857 *ret_copy = ErrorAction_clone(orig_conv);
19858 uint64_t ret_ref = (uint64_t)ret_copy;
19862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19863 LDKLightningError this_obj_conv;
19864 this_obj_conv.inner = (void*)(this_obj & (~1));
19865 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19866 LightningError_free(this_obj_conv);
19869 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
19870 LDKLightningError this_ptr_conv;
19871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19872 this_ptr_conv.is_owned = false;
19873 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
19874 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
19879 LDKLightningError this_ptr_conv;
19880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19881 this_ptr_conv.is_owned = false;
19882 LDKStr val_conv = java_to_owned_str(env, val);
19883 LightningError_set_err(&this_ptr_conv, val_conv);
19886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
19887 LDKLightningError this_ptr_conv;
19888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19889 this_ptr_conv.is_owned = false;
19890 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19891 *ret_copy = LightningError_get_action(&this_ptr_conv);
19892 uint64_t ret_ref = (uint64_t)ret_copy;
19896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19897 LDKLightningError this_ptr_conv;
19898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19899 this_ptr_conv.is_owned = false;
19900 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
19901 LightningError_set_action(&this_ptr_conv, val_conv);
19904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
19905 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
19906 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
19907 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
19908 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19909 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19910 uint64_t ret_ref = (uint64_t)ret_var.inner;
19911 if (ret_var.is_owned) {
19917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19918 LDKLightningError orig_conv;
19919 orig_conv.inner = (void*)(orig & (~1));
19920 orig_conv.is_owned = false;
19921 LDKLightningError ret_var = LightningError_clone(&orig_conv);
19922 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19923 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19924 uint64_t ret_ref = (uint64_t)ret_var.inner;
19925 if (ret_var.is_owned) {
19931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19932 LDKCommitmentUpdate this_obj_conv;
19933 this_obj_conv.inner = (void*)(this_obj & (~1));
19934 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19935 CommitmentUpdate_free(this_obj_conv);
19938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19939 LDKCommitmentUpdate this_ptr_conv;
19940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19941 this_ptr_conv.is_owned = false;
19942 LDKCVec_UpdateAddHTLCZ val_constr;
19943 val_constr.datalen = (*env)->GetArrayLength(env, val);
19944 if (val_constr.datalen > 0)
19945 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19947 val_constr.data = NULL;
19948 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19949 for (size_t p = 0; p < val_constr.datalen; p++) {
19950 int64_t val_conv_15 = val_vals[p];
19951 LDKUpdateAddHTLC val_conv_15_conv;
19952 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
19953 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
19954 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
19955 val_constr.data[p] = val_conv_15_conv;
19957 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19958 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
19961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19962 LDKCommitmentUpdate this_ptr_conv;
19963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19964 this_ptr_conv.is_owned = false;
19965 LDKCVec_UpdateFulfillHTLCZ val_constr;
19966 val_constr.datalen = (*env)->GetArrayLength(env, val);
19967 if (val_constr.datalen > 0)
19968 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19970 val_constr.data = NULL;
19971 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19972 for (size_t t = 0; t < val_constr.datalen; t++) {
19973 int64_t val_conv_19 = val_vals[t];
19974 LDKUpdateFulfillHTLC val_conv_19_conv;
19975 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
19976 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
19977 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
19978 val_constr.data[t] = val_conv_19_conv;
19980 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19981 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
19984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19985 LDKCommitmentUpdate this_ptr_conv;
19986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19987 this_ptr_conv.is_owned = false;
19988 LDKCVec_UpdateFailHTLCZ val_constr;
19989 val_constr.datalen = (*env)->GetArrayLength(env, val);
19990 if (val_constr.datalen > 0)
19991 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19993 val_constr.data = NULL;
19994 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19995 for (size_t q = 0; q < val_constr.datalen; q++) {
19996 int64_t val_conv_16 = val_vals[q];
19997 LDKUpdateFailHTLC val_conv_16_conv;
19998 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
19999 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
20000 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
20001 val_constr.data[q] = val_conv_16_conv;
20003 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20004 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
20007 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) {
20008 LDKCommitmentUpdate this_ptr_conv;
20009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20010 this_ptr_conv.is_owned = false;
20011 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
20012 val_constr.datalen = (*env)->GetArrayLength(env, val);
20013 if (val_constr.datalen > 0)
20014 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20016 val_constr.data = NULL;
20017 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20018 for (size_t z = 0; z < val_constr.datalen; z++) {
20019 int64_t val_conv_25 = val_vals[z];
20020 LDKUpdateFailMalformedHTLC val_conv_25_conv;
20021 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
20022 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
20023 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
20024 val_constr.data[z] = val_conv_25_conv;
20026 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20027 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
20030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
20031 LDKCommitmentUpdate this_ptr_conv;
20032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20033 this_ptr_conv.is_owned = false;
20034 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
20035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20036 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20037 uint64_t ret_ref = (uint64_t)ret_var.inner;
20038 if (ret_var.is_owned) {
20044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20045 LDKCommitmentUpdate this_ptr_conv;
20046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20047 this_ptr_conv.is_owned = false;
20048 LDKUpdateFee val_conv;
20049 val_conv.inner = (void*)(val & (~1));
20050 val_conv.is_owned = (val & 1) || (val == 0);
20051 val_conv = UpdateFee_clone(&val_conv);
20052 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
20055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
20056 LDKCommitmentUpdate this_ptr_conv;
20057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20058 this_ptr_conv.is_owned = false;
20059 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
20060 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20061 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20062 uint64_t ret_ref = (uint64_t)ret_var.inner;
20063 if (ret_var.is_owned) {
20069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20070 LDKCommitmentUpdate this_ptr_conv;
20071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20072 this_ptr_conv.is_owned = false;
20073 LDKCommitmentSigned val_conv;
20074 val_conv.inner = (void*)(val & (~1));
20075 val_conv.is_owned = (val & 1) || (val == 0);
20076 val_conv = CommitmentSigned_clone(&val_conv);
20077 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
20080 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) {
20081 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
20082 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
20083 if (update_add_htlcs_arg_constr.datalen > 0)
20084 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20086 update_add_htlcs_arg_constr.data = NULL;
20087 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
20088 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
20089 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
20090 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
20091 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
20092 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
20093 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
20094 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
20096 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
20097 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
20098 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
20099 if (update_fulfill_htlcs_arg_constr.datalen > 0)
20100 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20102 update_fulfill_htlcs_arg_constr.data = NULL;
20103 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
20104 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
20105 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
20106 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
20107 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
20108 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
20109 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
20110 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
20112 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
20113 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
20114 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
20115 if (update_fail_htlcs_arg_constr.datalen > 0)
20116 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20118 update_fail_htlcs_arg_constr.data = NULL;
20119 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
20120 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
20121 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
20122 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
20123 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
20124 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
20125 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
20126 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
20128 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
20129 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
20130 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
20131 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
20132 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20134 update_fail_malformed_htlcs_arg_constr.data = NULL;
20135 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
20136 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
20137 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
20138 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
20139 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
20140 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);
20141 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
20142 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
20144 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
20145 LDKUpdateFee update_fee_arg_conv;
20146 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
20147 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
20148 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
20149 LDKCommitmentSigned commitment_signed_arg_conv;
20150 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
20151 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
20152 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
20153 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);
20154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20156 uint64_t ret_ref = (uint64_t)ret_var.inner;
20157 if (ret_var.is_owned) {
20163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20164 LDKCommitmentUpdate orig_conv;
20165 orig_conv.inner = (void*)(orig & (~1));
20166 orig_conv.is_owned = false;
20167 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
20168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20170 uint64_t ret_ref = (uint64_t)ret_var.inner;
20171 if (ret_var.is_owned) {
20177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20178 if ((this_ptr & 1) != 0) return;
20179 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
20180 FREE((void*)this_ptr);
20181 HTLCFailChannelUpdate_free(this_ptr_conv);
20184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20185 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
20186 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
20187 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
20188 uint64_t ret_ref = (uint64_t)ret_copy;
20192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20193 if ((this_ptr & 1) != 0) return;
20194 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
20195 FREE((void*)this_ptr);
20196 ChannelMessageHandler_free(this_ptr_conv);
20199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20200 if ((this_ptr & 1) != 0) return;
20201 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
20202 FREE((void*)this_ptr);
20203 RoutingMessageHandler_free(this_ptr_conv);
20206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
20207 LDKAcceptChannel obj_conv;
20208 obj_conv.inner = (void*)(obj & (~1));
20209 obj_conv.is_owned = false;
20210 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
20211 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20212 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20213 CVec_u8Z_free(ret_var);
20217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20218 LDKu8slice ser_ref;
20219 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20220 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20221 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20222 *ret_conv = AcceptChannel_read(ser_ref);
20223 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20224 return (uint64_t)ret_conv;
20227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
20228 LDKAnnouncementSignatures obj_conv;
20229 obj_conv.inner = (void*)(obj & (~1));
20230 obj_conv.is_owned = false;
20231 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
20232 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20233 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20234 CVec_u8Z_free(ret_var);
20238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20239 LDKu8slice ser_ref;
20240 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20241 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20242 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20243 *ret_conv = AnnouncementSignatures_read(ser_ref);
20244 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20245 return (uint64_t)ret_conv;
20248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
20249 LDKChannelReestablish obj_conv;
20250 obj_conv.inner = (void*)(obj & (~1));
20251 obj_conv.is_owned = false;
20252 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
20253 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20254 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20255 CVec_u8Z_free(ret_var);
20259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20260 LDKu8slice ser_ref;
20261 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20262 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20263 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20264 *ret_conv = ChannelReestablish_read(ser_ref);
20265 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20266 return (uint64_t)ret_conv;
20269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20270 LDKClosingSigned obj_conv;
20271 obj_conv.inner = (void*)(obj & (~1));
20272 obj_conv.is_owned = false;
20273 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
20274 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20275 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20276 CVec_u8Z_free(ret_var);
20280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20281 LDKu8slice ser_ref;
20282 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20283 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20284 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20285 *ret_conv = ClosingSigned_read(ser_ref);
20286 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20287 return (uint64_t)ret_conv;
20290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20291 LDKCommitmentSigned obj_conv;
20292 obj_conv.inner = (void*)(obj & (~1));
20293 obj_conv.is_owned = false;
20294 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
20295 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20296 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20297 CVec_u8Z_free(ret_var);
20301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20302 LDKu8slice ser_ref;
20303 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20304 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20305 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20306 *ret_conv = CommitmentSigned_read(ser_ref);
20307 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20308 return (uint64_t)ret_conv;
20311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
20312 LDKFundingCreated obj_conv;
20313 obj_conv.inner = (void*)(obj & (~1));
20314 obj_conv.is_owned = false;
20315 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20316 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20317 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20318 CVec_u8Z_free(ret_var);
20322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20323 LDKu8slice ser_ref;
20324 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20325 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20326 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20327 *ret_conv = FundingCreated_read(ser_ref);
20328 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20329 return (uint64_t)ret_conv;
20332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20333 LDKFundingSigned obj_conv;
20334 obj_conv.inner = (void*)(obj & (~1));
20335 obj_conv.is_owned = false;
20336 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20337 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20338 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20339 CVec_u8Z_free(ret_var);
20343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20344 LDKu8slice ser_ref;
20345 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20346 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20347 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20348 *ret_conv = FundingSigned_read(ser_ref);
20349 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20350 return (uint64_t)ret_conv;
20353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
20354 LDKFundingLocked obj_conv;
20355 obj_conv.inner = (void*)(obj & (~1));
20356 obj_conv.is_owned = false;
20357 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20358 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20359 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20360 CVec_u8Z_free(ret_var);
20364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20365 LDKu8slice ser_ref;
20366 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20367 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20368 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20369 *ret_conv = FundingLocked_read(ser_ref);
20370 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20371 return (uint64_t)ret_conv;
20374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
20376 obj_conv.inner = (void*)(obj & (~1));
20377 obj_conv.is_owned = false;
20378 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
20379 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20380 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20381 CVec_u8Z_free(ret_var);
20385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20386 LDKu8slice ser_ref;
20387 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20388 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20389 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20390 *ret_conv = Init_read(ser_ref);
20391 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20392 return (uint64_t)ret_conv;
20395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
20396 LDKOpenChannel obj_conv;
20397 obj_conv.inner = (void*)(obj & (~1));
20398 obj_conv.is_owned = false;
20399 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
20400 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20401 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20402 CVec_u8Z_free(ret_var);
20406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20407 LDKu8slice ser_ref;
20408 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20409 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20410 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20411 *ret_conv = OpenChannel_read(ser_ref);
20412 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20413 return (uint64_t)ret_conv;
20416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
20417 LDKRevokeAndACK obj_conv;
20418 obj_conv.inner = (void*)(obj & (~1));
20419 obj_conv.is_owned = false;
20420 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
20421 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20422 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20423 CVec_u8Z_free(ret_var);
20427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20428 LDKu8slice ser_ref;
20429 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20430 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20431 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20432 *ret_conv = RevokeAndACK_read(ser_ref);
20433 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20434 return (uint64_t)ret_conv;
20437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
20438 LDKShutdown obj_conv;
20439 obj_conv.inner = (void*)(obj & (~1));
20440 obj_conv.is_owned = false;
20441 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
20442 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20443 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20444 CVec_u8Z_free(ret_var);
20448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20449 LDKu8slice ser_ref;
20450 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20451 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20452 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20453 *ret_conv = Shutdown_read(ser_ref);
20454 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20455 return (uint64_t)ret_conv;
20458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20459 LDKUpdateFailHTLC obj_conv;
20460 obj_conv.inner = (void*)(obj & (~1));
20461 obj_conv.is_owned = false;
20462 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
20463 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20464 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20465 CVec_u8Z_free(ret_var);
20469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20470 LDKu8slice ser_ref;
20471 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20472 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20473 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20474 *ret_conv = UpdateFailHTLC_read(ser_ref);
20475 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20476 return (uint64_t)ret_conv;
20479 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20480 LDKUpdateFailMalformedHTLC obj_conv;
20481 obj_conv.inner = (void*)(obj & (~1));
20482 obj_conv.is_owned = false;
20483 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
20484 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20485 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20486 CVec_u8Z_free(ret_var);
20490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20491 LDKu8slice ser_ref;
20492 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20493 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20494 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20495 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
20496 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20497 return (uint64_t)ret_conv;
20500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
20501 LDKUpdateFee obj_conv;
20502 obj_conv.inner = (void*)(obj & (~1));
20503 obj_conv.is_owned = false;
20504 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
20505 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20506 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20507 CVec_u8Z_free(ret_var);
20511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20512 LDKu8slice ser_ref;
20513 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20514 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20515 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20516 *ret_conv = UpdateFee_read(ser_ref);
20517 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20518 return (uint64_t)ret_conv;
20521 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20522 LDKUpdateFulfillHTLC obj_conv;
20523 obj_conv.inner = (void*)(obj & (~1));
20524 obj_conv.is_owned = false;
20525 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
20526 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20527 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20528 CVec_u8Z_free(ret_var);
20532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20533 LDKu8slice ser_ref;
20534 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20535 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20536 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20537 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
20538 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20539 return (uint64_t)ret_conv;
20542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20543 LDKUpdateAddHTLC obj_conv;
20544 obj_conv.inner = (void*)(obj & (~1));
20545 obj_conv.is_owned = false;
20546 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
20547 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20548 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20549 CVec_u8Z_free(ret_var);
20553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20554 LDKu8slice ser_ref;
20555 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20556 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20557 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20558 *ret_conv = UpdateAddHTLC_read(ser_ref);
20559 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20560 return (uint64_t)ret_conv;
20563 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
20565 obj_conv.inner = (void*)(obj & (~1));
20566 obj_conv.is_owned = false;
20567 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
20568 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20569 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20570 CVec_u8Z_free(ret_var);
20574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20575 LDKu8slice ser_ref;
20576 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20577 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20578 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20579 *ret_conv = Ping_read(ser_ref);
20580 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20581 return (uint64_t)ret_conv;
20584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
20586 obj_conv.inner = (void*)(obj & (~1));
20587 obj_conv.is_owned = false;
20588 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
20589 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20590 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20591 CVec_u8Z_free(ret_var);
20595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20596 LDKu8slice ser_ref;
20597 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20598 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20599 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20600 *ret_conv = Pong_read(ser_ref);
20601 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20602 return (uint64_t)ret_conv;
20605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20606 LDKUnsignedChannelAnnouncement obj_conv;
20607 obj_conv.inner = (void*)(obj & (~1));
20608 obj_conv.is_owned = false;
20609 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
20610 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20611 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20612 CVec_u8Z_free(ret_var);
20616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20617 LDKu8slice ser_ref;
20618 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20619 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20620 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20621 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
20622 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20623 return (uint64_t)ret_conv;
20626 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20627 LDKChannelAnnouncement obj_conv;
20628 obj_conv.inner = (void*)(obj & (~1));
20629 obj_conv.is_owned = false;
20630 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
20631 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20632 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20633 CVec_u8Z_free(ret_var);
20637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20638 LDKu8slice ser_ref;
20639 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20640 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20641 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20642 *ret_conv = ChannelAnnouncement_read(ser_ref);
20643 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20644 return (uint64_t)ret_conv;
20647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20648 LDKUnsignedChannelUpdate obj_conv;
20649 obj_conv.inner = (void*)(obj & (~1));
20650 obj_conv.is_owned = false;
20651 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
20652 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20653 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20654 CVec_u8Z_free(ret_var);
20658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20659 LDKu8slice ser_ref;
20660 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20661 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20662 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20663 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
20664 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20665 return (uint64_t)ret_conv;
20668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20669 LDKChannelUpdate obj_conv;
20670 obj_conv.inner = (void*)(obj & (~1));
20671 obj_conv.is_owned = false;
20672 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
20673 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20674 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20675 CVec_u8Z_free(ret_var);
20679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20680 LDKu8slice ser_ref;
20681 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20682 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20683 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20684 *ret_conv = ChannelUpdate_read(ser_ref);
20685 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20686 return (uint64_t)ret_conv;
20689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
20690 LDKErrorMessage obj_conv;
20691 obj_conv.inner = (void*)(obj & (~1));
20692 obj_conv.is_owned = false;
20693 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
20694 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20695 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20696 CVec_u8Z_free(ret_var);
20700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20701 LDKu8slice ser_ref;
20702 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20703 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20704 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20705 *ret_conv = ErrorMessage_read(ser_ref);
20706 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20707 return (uint64_t)ret_conv;
20710 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20711 LDKUnsignedNodeAnnouncement obj_conv;
20712 obj_conv.inner = (void*)(obj & (~1));
20713 obj_conv.is_owned = false;
20714 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
20715 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20716 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20717 CVec_u8Z_free(ret_var);
20721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20722 LDKu8slice ser_ref;
20723 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20724 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20725 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20726 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
20727 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20728 return (uint64_t)ret_conv;
20731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20732 LDKNodeAnnouncement obj_conv;
20733 obj_conv.inner = (void*)(obj & (~1));
20734 obj_conv.is_owned = false;
20735 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
20736 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20737 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20738 CVec_u8Z_free(ret_var);
20742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20743 LDKu8slice ser_ref;
20744 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20745 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20746 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20747 *ret_conv = NodeAnnouncement_read(ser_ref);
20748 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20749 return (uint64_t)ret_conv;
20752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20753 LDKu8slice ser_ref;
20754 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20755 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20756 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20757 *ret_conv = QueryShortChannelIds_read(ser_ref);
20758 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20759 return (uint64_t)ret_conv;
20762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
20763 LDKQueryShortChannelIds obj_conv;
20764 obj_conv.inner = (void*)(obj & (~1));
20765 obj_conv.is_owned = false;
20766 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
20767 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20768 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20769 CVec_u8Z_free(ret_var);
20773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20774 LDKu8slice ser_ref;
20775 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20776 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20777 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20778 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
20779 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20780 return (uint64_t)ret_conv;
20783 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
20784 LDKReplyShortChannelIdsEnd obj_conv;
20785 obj_conv.inner = (void*)(obj & (~1));
20786 obj_conv.is_owned = false;
20787 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
20788 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20789 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20790 CVec_u8Z_free(ret_var);
20794 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
20795 LDKQueryChannelRange this_arg_conv;
20796 this_arg_conv.inner = (void*)(this_arg & (~1));
20797 this_arg_conv.is_owned = false;
20798 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
20802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20803 LDKu8slice ser_ref;
20804 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20805 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20806 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20807 *ret_conv = QueryChannelRange_read(ser_ref);
20808 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20809 return (uint64_t)ret_conv;
20812 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20813 LDKQueryChannelRange obj_conv;
20814 obj_conv.inner = (void*)(obj & (~1));
20815 obj_conv.is_owned = false;
20816 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
20817 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20818 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20819 CVec_u8Z_free(ret_var);
20823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20824 LDKu8slice ser_ref;
20825 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20826 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20827 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20828 *ret_conv = ReplyChannelRange_read(ser_ref);
20829 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20830 return (uint64_t)ret_conv;
20833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20834 LDKReplyChannelRange obj_conv;
20835 obj_conv.inner = (void*)(obj & (~1));
20836 obj_conv.is_owned = false;
20837 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
20838 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20839 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20840 CVec_u8Z_free(ret_var);
20844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20845 LDKu8slice ser_ref;
20846 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20847 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20848 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20849 *ret_conv = GossipTimestampFilter_read(ser_ref);
20850 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20851 return (uint64_t)ret_conv;
20854 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
20855 LDKGossipTimestampFilter obj_conv;
20856 obj_conv.inner = (void*)(obj & (~1));
20857 obj_conv.is_owned = false;
20858 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
20859 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20860 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20861 CVec_u8Z_free(ret_var);
20865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20866 LDKIgnoringMessageHandler this_obj_conv;
20867 this_obj_conv.inner = (void*)(this_obj & (~1));
20868 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20869 IgnoringMessageHandler_free(this_obj_conv);
20872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
20873 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
20874 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20875 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20876 uint64_t ret_ref = (uint64_t)ret_var.inner;
20877 if (ret_var.is_owned) {
20883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20884 LDKIgnoringMessageHandler this_arg_conv;
20885 this_arg_conv.inner = (void*)(this_arg & (~1));
20886 this_arg_conv.is_owned = false;
20887 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20888 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20889 return (uint64_t)ret;
20892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20893 LDKIgnoringMessageHandler this_arg_conv;
20894 this_arg_conv.inner = (void*)(this_arg & (~1));
20895 this_arg_conv.is_owned = false;
20896 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
20897 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
20898 return (uint64_t)ret;
20901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20902 LDKErroringMessageHandler this_obj_conv;
20903 this_obj_conv.inner = (void*)(this_obj & (~1));
20904 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20905 ErroringMessageHandler_free(this_obj_conv);
20908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
20909 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
20910 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20911 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20912 uint64_t ret_ref = (uint64_t)ret_var.inner;
20913 if (ret_var.is_owned) {
20919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20920 LDKErroringMessageHandler this_arg_conv;
20921 this_arg_conv.inner = (void*)(this_arg & (~1));
20922 this_arg_conv.is_owned = false;
20923 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20924 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20925 return (uint64_t)ret;
20928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20929 LDKErroringMessageHandler this_arg_conv;
20930 this_arg_conv.inner = (void*)(this_arg & (~1));
20931 this_arg_conv.is_owned = false;
20932 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20933 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
20934 return (uint64_t)ret;
20937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20938 LDKMessageHandler this_obj_conv;
20939 this_obj_conv.inner = (void*)(this_obj & (~1));
20940 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20941 MessageHandler_free(this_obj_conv);
20944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20945 LDKMessageHandler this_ptr_conv;
20946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20947 this_ptr_conv.is_owned = false;
20948 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
20952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20953 LDKMessageHandler this_ptr_conv;
20954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20955 this_ptr_conv.is_owned = false;
20956 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
20957 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
20958 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20959 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
20961 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
20964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20965 LDKMessageHandler this_ptr_conv;
20966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20967 this_ptr_conv.is_owned = false;
20968 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
20972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20973 LDKMessageHandler this_ptr_conv;
20974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20975 this_ptr_conv.is_owned = false;
20976 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
20977 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20978 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20979 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
20981 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
20984 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) {
20985 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
20986 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
20987 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20988 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
20990 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
20991 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20992 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20993 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
20995 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
20996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20998 uint64_t ret_ref = (uint64_t)ret_var.inner;
20999 if (ret_var.is_owned) {
21005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21006 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
21007 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
21008 *ret = SocketDescriptor_clone(orig_conv);
21009 return (uint64_t)ret;
21012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21013 if ((this_ptr & 1) != 0) return;
21014 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
21015 FREE((void*)this_ptr);
21016 SocketDescriptor_free(this_ptr_conv);
21019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21020 LDKPeerHandleError this_obj_conv;
21021 this_obj_conv.inner = (void*)(this_obj & (~1));
21022 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21023 PeerHandleError_free(this_obj_conv);
21026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
21027 LDKPeerHandleError this_ptr_conv;
21028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21029 this_ptr_conv.is_owned = false;
21030 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
21034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21035 LDKPeerHandleError this_ptr_conv;
21036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21037 this_ptr_conv.is_owned = false;
21038 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
21041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
21042 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
21043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21045 uint64_t ret_ref = (uint64_t)ret_var.inner;
21046 if (ret_var.is_owned) {
21052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21053 LDKPeerHandleError orig_conv;
21054 orig_conv.inner = (void*)(orig & (~1));
21055 orig_conv.is_owned = false;
21056 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
21057 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21058 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21059 uint64_t ret_ref = (uint64_t)ret_var.inner;
21060 if (ret_var.is_owned) {
21066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21067 LDKPeerManager this_obj_conv;
21068 this_obj_conv.inner = (void*)(this_obj & (~1));
21069 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21070 PeerManager_free(this_obj_conv);
21073 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) {
21074 LDKMessageHandler message_handler_conv;
21075 message_handler_conv.inner = (void*)(message_handler & (~1));
21076 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
21077 // Warning: we need a move here but no clone is available for LDKMessageHandler
21078 LDKSecretKey our_node_secret_ref;
21079 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
21080 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
21081 unsigned char ephemeral_random_data_arr[32];
21082 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
21083 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
21084 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
21085 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21086 if (logger_conv.free == LDKLogger_JCalls_free) {
21087 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21088 LDKLogger_JCalls_clone(logger_conv.this_arg);
21090 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
21091 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21092 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21093 uint64_t ret_ref = (uint64_t)ret_var.inner;
21094 if (ret_var.is_owned) {
21100 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
21101 LDKPeerManager this_arg_conv;
21102 this_arg_conv.inner = (void*)(this_arg & (~1));
21103 this_arg_conv.is_owned = false;
21104 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
21105 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
21107 for (size_t i = 0; i < ret_var.datalen; i++) {
21108 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
21109 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
21110 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
21112 FREE(ret_var.data);
21116 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) {
21117 LDKPeerManager this_arg_conv;
21118 this_arg_conv.inner = (void*)(this_arg & (~1));
21119 this_arg_conv.is_owned = false;
21120 LDKPublicKey their_node_id_ref;
21121 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21122 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21123 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21124 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
21125 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21126 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
21128 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21129 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
21130 return (uint64_t)ret_conv;
21133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
21134 LDKPeerManager this_arg_conv;
21135 this_arg_conv.inner = (void*)(this_arg & (~1));
21136 this_arg_conv.is_owned = false;
21137 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21138 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
21139 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21140 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
21142 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21143 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
21144 return (uint64_t)ret_conv;
21147 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) {
21148 LDKPeerManager this_arg_conv;
21149 this_arg_conv.inner = (void*)(this_arg & (~1));
21150 this_arg_conv.is_owned = false;
21151 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21152 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21153 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
21154 return (uint64_t)ret_conv;
21157 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) {
21158 LDKPeerManager this_arg_conv;
21159 this_arg_conv.inner = (void*)(this_arg & (~1));
21160 this_arg_conv.is_owned = false;
21161 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
21162 LDKu8slice data_ref;
21163 data_ref.datalen = (*env)->GetArrayLength(env, data);
21164 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
21165 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21166 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
21167 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
21168 return (uint64_t)ret_conv;
21171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
21172 LDKPeerManager this_arg_conv;
21173 this_arg_conv.inner = (void*)(this_arg & (~1));
21174 this_arg_conv.is_owned = false;
21175 PeerManager_process_events(&this_arg_conv);
21178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
21179 LDKPeerManager this_arg_conv;
21180 this_arg_conv.inner = (void*)(this_arg & (~1));
21181 this_arg_conv.is_owned = false;
21182 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21183 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
21186 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) {
21187 LDKPeerManager this_arg_conv;
21188 this_arg_conv.inner = (void*)(this_arg & (~1));
21189 this_arg_conv.is_owned = false;
21190 LDKPublicKey node_id_ref;
21191 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21192 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21193 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
21196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
21197 LDKPeerManager this_arg_conv;
21198 this_arg_conv.inner = (void*)(this_arg & (~1));
21199 this_arg_conv.is_owned = false;
21200 PeerManager_timer_tick_occurred(&this_arg_conv);
21203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
21204 unsigned char commitment_seed_arr[32];
21205 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
21206 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
21207 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
21208 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21209 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
21213 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) {
21214 LDKPublicKey per_commitment_point_ref;
21215 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21216 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21217 unsigned char base_secret_arr[32];
21218 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
21219 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
21220 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
21221 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21222 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
21223 return (uint64_t)ret_conv;
21226 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) {
21227 LDKPublicKey per_commitment_point_ref;
21228 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21229 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21230 LDKPublicKey base_point_ref;
21231 CHECK((*env)->GetArrayLength(env, base_point) == 33);
21232 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
21233 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21234 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
21235 return (uint64_t)ret_conv;
21238 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) {
21239 unsigned char per_commitment_secret_arr[32];
21240 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
21241 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
21242 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
21243 unsigned char countersignatory_revocation_base_secret_arr[32];
21244 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
21245 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
21246 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
21247 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21248 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
21249 return (uint64_t)ret_conv;
21252 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) {
21253 LDKPublicKey per_commitment_point_ref;
21254 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21255 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21256 LDKPublicKey countersignatory_revocation_base_point_ref;
21257 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
21258 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
21259 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21260 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
21261 return (uint64_t)ret_conv;
21264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21265 LDKTxCreationKeys this_obj_conv;
21266 this_obj_conv.inner = (void*)(this_obj & (~1));
21267 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21268 TxCreationKeys_free(this_obj_conv);
21271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21272 LDKTxCreationKeys this_ptr_conv;
21273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21274 this_ptr_conv.is_owned = false;
21275 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21276 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
21280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21281 LDKTxCreationKeys this_ptr_conv;
21282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21283 this_ptr_conv.is_owned = false;
21284 LDKPublicKey val_ref;
21285 CHECK((*env)->GetArrayLength(env, val) == 33);
21286 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21287 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
21290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21291 LDKTxCreationKeys this_ptr_conv;
21292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21293 this_ptr_conv.is_owned = false;
21294 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21295 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
21299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21300 LDKTxCreationKeys this_ptr_conv;
21301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21302 this_ptr_conv.is_owned = false;
21303 LDKPublicKey val_ref;
21304 CHECK((*env)->GetArrayLength(env, val) == 33);
21305 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21306 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21310 LDKTxCreationKeys this_ptr_conv;
21311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21312 this_ptr_conv.is_owned = false;
21313 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21314 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
21318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21319 LDKTxCreationKeys this_ptr_conv;
21320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21321 this_ptr_conv.is_owned = false;
21322 LDKPublicKey val_ref;
21323 CHECK((*env)->GetArrayLength(env, val) == 33);
21324 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21325 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21329 LDKTxCreationKeys this_ptr_conv;
21330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21331 this_ptr_conv.is_owned = false;
21332 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21333 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
21337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21338 LDKTxCreationKeys this_ptr_conv;
21339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21340 this_ptr_conv.is_owned = false;
21341 LDKPublicKey val_ref;
21342 CHECK((*env)->GetArrayLength(env, val) == 33);
21343 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21344 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21348 LDKTxCreationKeys this_ptr_conv;
21349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21350 this_ptr_conv.is_owned = false;
21351 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21352 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
21356 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) {
21357 LDKTxCreationKeys this_ptr_conv;
21358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21359 this_ptr_conv.is_owned = false;
21360 LDKPublicKey val_ref;
21361 CHECK((*env)->GetArrayLength(env, val) == 33);
21362 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21363 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21366 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) {
21367 LDKPublicKey per_commitment_point_arg_ref;
21368 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
21369 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
21370 LDKPublicKey revocation_key_arg_ref;
21371 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
21372 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
21373 LDKPublicKey broadcaster_htlc_key_arg_ref;
21374 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
21375 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
21376 LDKPublicKey countersignatory_htlc_key_arg_ref;
21377 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
21378 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
21379 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21380 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
21381 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
21382 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);
21383 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21384 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21385 uint64_t ret_ref = (uint64_t)ret_var.inner;
21386 if (ret_var.is_owned) {
21392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21393 LDKTxCreationKeys orig_conv;
21394 orig_conv.inner = (void*)(orig & (~1));
21395 orig_conv.is_owned = false;
21396 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
21397 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21398 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21399 uint64_t ret_ref = (uint64_t)ret_var.inner;
21400 if (ret_var.is_owned) {
21406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21407 LDKTxCreationKeys obj_conv;
21408 obj_conv.inner = (void*)(obj & (~1));
21409 obj_conv.is_owned = false;
21410 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
21411 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21412 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21413 CVec_u8Z_free(ret_var);
21417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21418 LDKu8slice ser_ref;
21419 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21420 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21421 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
21422 *ret_conv = TxCreationKeys_read(ser_ref);
21423 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21424 return (uint64_t)ret_conv;
21427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21428 LDKChannelPublicKeys this_obj_conv;
21429 this_obj_conv.inner = (void*)(this_obj & (~1));
21430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21431 ChannelPublicKeys_free(this_obj_conv);
21434 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21435 LDKChannelPublicKeys this_ptr_conv;
21436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21437 this_ptr_conv.is_owned = false;
21438 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21439 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
21443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21444 LDKChannelPublicKeys this_ptr_conv;
21445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21446 this_ptr_conv.is_owned = false;
21447 LDKPublicKey val_ref;
21448 CHECK((*env)->GetArrayLength(env, val) == 33);
21449 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21450 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
21453 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21454 LDKChannelPublicKeys this_ptr_conv;
21455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21456 this_ptr_conv.is_owned = false;
21457 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21458 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
21462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21463 LDKChannelPublicKeys this_ptr_conv;
21464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21465 this_ptr_conv.is_owned = false;
21466 LDKPublicKey val_ref;
21467 CHECK((*env)->GetArrayLength(env, val) == 33);
21468 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21469 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
21472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21473 LDKChannelPublicKeys this_ptr_conv;
21474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21475 this_ptr_conv.is_owned = false;
21476 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21477 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
21481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21482 LDKChannelPublicKeys this_ptr_conv;
21483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21484 this_ptr_conv.is_owned = false;
21485 LDKPublicKey val_ref;
21486 CHECK((*env)->GetArrayLength(env, val) == 33);
21487 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21488 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
21491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21492 LDKChannelPublicKeys this_ptr_conv;
21493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21494 this_ptr_conv.is_owned = false;
21495 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21496 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
21500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21501 LDKChannelPublicKeys this_ptr_conv;
21502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21503 this_ptr_conv.is_owned = false;
21504 LDKPublicKey val_ref;
21505 CHECK((*env)->GetArrayLength(env, val) == 33);
21506 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21507 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21511 LDKChannelPublicKeys this_ptr_conv;
21512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21513 this_ptr_conv.is_owned = false;
21514 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21515 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
21519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21520 LDKChannelPublicKeys this_ptr_conv;
21521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21522 this_ptr_conv.is_owned = false;
21523 LDKPublicKey val_ref;
21524 CHECK((*env)->GetArrayLength(env, val) == 33);
21525 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21526 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
21529 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) {
21530 LDKPublicKey funding_pubkey_arg_ref;
21531 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
21532 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
21533 LDKPublicKey revocation_basepoint_arg_ref;
21534 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
21535 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
21536 LDKPublicKey payment_point_arg_ref;
21537 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
21538 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
21539 LDKPublicKey delayed_payment_basepoint_arg_ref;
21540 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
21541 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
21542 LDKPublicKey htlc_basepoint_arg_ref;
21543 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
21544 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
21545 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);
21546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21548 uint64_t ret_ref = (uint64_t)ret_var.inner;
21549 if (ret_var.is_owned) {
21555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21556 LDKChannelPublicKeys orig_conv;
21557 orig_conv.inner = (void*)(orig & (~1));
21558 orig_conv.is_owned = false;
21559 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
21560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21562 uint64_t ret_ref = (uint64_t)ret_var.inner;
21563 if (ret_var.is_owned) {
21569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21570 LDKChannelPublicKeys obj_conv;
21571 obj_conv.inner = (void*)(obj & (~1));
21572 obj_conv.is_owned = false;
21573 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
21574 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21575 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21576 CVec_u8Z_free(ret_var);
21580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21581 LDKu8slice ser_ref;
21582 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21583 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21584 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
21585 *ret_conv = ChannelPublicKeys_read(ser_ref);
21586 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21587 return (uint64_t)ret_conv;
21590 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) {
21591 LDKPublicKey per_commitment_point_ref;
21592 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21593 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21594 LDKPublicKey broadcaster_delayed_payment_base_ref;
21595 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
21596 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
21597 LDKPublicKey broadcaster_htlc_base_ref;
21598 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
21599 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
21600 LDKPublicKey countersignatory_revocation_base_ref;
21601 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
21602 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
21603 LDKPublicKey countersignatory_htlc_base_ref;
21604 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
21605 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
21606 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21607 *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);
21608 return (uint64_t)ret_conv;
21611 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) {
21612 LDKPublicKey per_commitment_point_ref;
21613 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21614 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21615 LDKChannelPublicKeys broadcaster_keys_conv;
21616 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
21617 broadcaster_keys_conv.is_owned = false;
21618 LDKChannelPublicKeys countersignatory_keys_conv;
21619 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
21620 countersignatory_keys_conv.is_owned = false;
21621 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21622 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
21623 return (uint64_t)ret_conv;
21626 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) {
21627 LDKPublicKey revocation_key_ref;
21628 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21629 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21630 LDKPublicKey broadcaster_delayed_payment_key_ref;
21631 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21632 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21633 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
21634 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21635 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21636 CVec_u8Z_free(ret_var);
21640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21641 LDKHTLCOutputInCommitment this_obj_conv;
21642 this_obj_conv.inner = (void*)(this_obj & (~1));
21643 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21644 HTLCOutputInCommitment_free(this_obj_conv);
21647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
21648 LDKHTLCOutputInCommitment this_ptr_conv;
21649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21650 this_ptr_conv.is_owned = false;
21651 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
21655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21656 LDKHTLCOutputInCommitment this_ptr_conv;
21657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21658 this_ptr_conv.is_owned = false;
21659 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
21662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21663 LDKHTLCOutputInCommitment this_ptr_conv;
21664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21665 this_ptr_conv.is_owned = false;
21666 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
21670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21671 LDKHTLCOutputInCommitment this_ptr_conv;
21672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21673 this_ptr_conv.is_owned = false;
21674 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
21677 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
21678 LDKHTLCOutputInCommitment this_ptr_conv;
21679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21680 this_ptr_conv.is_owned = false;
21681 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
21685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21686 LDKHTLCOutputInCommitment this_ptr_conv;
21687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21688 this_ptr_conv.is_owned = false;
21689 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
21692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21693 LDKHTLCOutputInCommitment this_ptr_conv;
21694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21695 this_ptr_conv.is_owned = false;
21696 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21697 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
21701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21702 LDKHTLCOutputInCommitment this_ptr_conv;
21703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21704 this_ptr_conv.is_owned = false;
21705 LDKThirtyTwoBytes val_ref;
21706 CHECK((*env)->GetArrayLength(env, val) == 32);
21707 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21708 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
21711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
21712 LDKHTLCOutputInCommitment this_ptr_conv;
21713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21714 this_ptr_conv.is_owned = false;
21715 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21716 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
21717 uint64_t ret_ref = (uint64_t)ret_copy;
21721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21722 LDKHTLCOutputInCommitment this_ptr_conv;
21723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21724 this_ptr_conv.is_owned = false;
21725 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
21726 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
21729 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) {
21730 LDKThirtyTwoBytes payment_hash_arg_ref;
21731 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
21732 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
21733 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
21734 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
21735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21737 uint64_t ret_ref = (uint64_t)ret_var.inner;
21738 if (ret_var.is_owned) {
21744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21745 LDKHTLCOutputInCommitment orig_conv;
21746 orig_conv.inner = (void*)(orig & (~1));
21747 orig_conv.is_owned = false;
21748 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
21749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21751 uint64_t ret_ref = (uint64_t)ret_var.inner;
21752 if (ret_var.is_owned) {
21758 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
21759 LDKHTLCOutputInCommitment obj_conv;
21760 obj_conv.inner = (void*)(obj & (~1));
21761 obj_conv.is_owned = false;
21762 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
21763 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21764 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21765 CVec_u8Z_free(ret_var);
21769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21770 LDKu8slice ser_ref;
21771 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21772 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21773 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
21774 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
21775 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21776 return (uint64_t)ret_conv;
21779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
21780 LDKHTLCOutputInCommitment htlc_conv;
21781 htlc_conv.inner = (void*)(htlc & (~1));
21782 htlc_conv.is_owned = false;
21783 LDKTxCreationKeys keys_conv;
21784 keys_conv.inner = (void*)(keys & (~1));
21785 keys_conv.is_owned = false;
21786 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
21787 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21788 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21789 CVec_u8Z_free(ret_var);
21793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
21794 LDKPublicKey broadcaster_ref;
21795 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
21796 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
21797 LDKPublicKey countersignatory_ref;
21798 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
21799 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
21800 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
21801 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21802 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21803 CVec_u8Z_free(ret_var);
21807 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) {
21808 unsigned char commitment_txid_arr[32];
21809 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
21810 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
21811 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
21812 LDKHTLCOutputInCommitment htlc_conv;
21813 htlc_conv.inner = (void*)(htlc & (~1));
21814 htlc_conv.is_owned = false;
21815 LDKPublicKey broadcaster_delayed_payment_key_ref;
21816 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21817 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21818 LDKPublicKey revocation_key_ref;
21819 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21820 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21821 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
21822 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21823 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21824 Transaction_free(ret_var);
21828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21829 LDKChannelTransactionParameters this_obj_conv;
21830 this_obj_conv.inner = (void*)(this_obj & (~1));
21831 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21832 ChannelTransactionParameters_free(this_obj_conv);
21835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21836 LDKChannelTransactionParameters this_ptr_conv;
21837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21838 this_ptr_conv.is_owned = false;
21839 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
21840 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21841 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21842 uint64_t ret_ref = (uint64_t)ret_var.inner;
21843 if (ret_var.is_owned) {
21849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21850 LDKChannelTransactionParameters this_ptr_conv;
21851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21852 this_ptr_conv.is_owned = false;
21853 LDKChannelPublicKeys val_conv;
21854 val_conv.inner = (void*)(val & (~1));
21855 val_conv.is_owned = (val & 1) || (val == 0);
21856 val_conv = ChannelPublicKeys_clone(&val_conv);
21857 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
21860 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21861 LDKChannelTransactionParameters this_ptr_conv;
21862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21863 this_ptr_conv.is_owned = false;
21864 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
21868 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) {
21869 LDKChannelTransactionParameters this_ptr_conv;
21870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21871 this_ptr_conv.is_owned = false;
21872 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
21875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
21876 LDKChannelTransactionParameters this_ptr_conv;
21877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21878 this_ptr_conv.is_owned = false;
21879 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
21883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21884 LDKChannelTransactionParameters this_ptr_conv;
21885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21886 this_ptr_conv.is_owned = false;
21887 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
21890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
21891 LDKChannelTransactionParameters this_ptr_conv;
21892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21893 this_ptr_conv.is_owned = false;
21894 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
21895 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21896 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21897 uint64_t ret_ref = (uint64_t)ret_var.inner;
21898 if (ret_var.is_owned) {
21904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21905 LDKChannelTransactionParameters this_ptr_conv;
21906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21907 this_ptr_conv.is_owned = false;
21908 LDKCounterpartyChannelTransactionParameters val_conv;
21909 val_conv.inner = (void*)(val & (~1));
21910 val_conv.is_owned = (val & 1) || (val == 0);
21911 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
21912 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
21915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21916 LDKChannelTransactionParameters this_ptr_conv;
21917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21918 this_ptr_conv.is_owned = false;
21919 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
21920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21922 uint64_t ret_ref = (uint64_t)ret_var.inner;
21923 if (ret_var.is_owned) {
21929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21930 LDKChannelTransactionParameters this_ptr_conv;
21931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21932 this_ptr_conv.is_owned = false;
21933 LDKOutPoint val_conv;
21934 val_conv.inner = (void*)(val & (~1));
21935 val_conv.is_owned = (val & 1) || (val == 0);
21936 val_conv = OutPoint_clone(&val_conv);
21937 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
21940 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) {
21941 LDKChannelPublicKeys holder_pubkeys_arg_conv;
21942 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
21943 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
21944 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
21945 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
21946 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
21947 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
21948 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
21949 LDKOutPoint funding_outpoint_arg_conv;
21950 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
21951 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
21952 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
21953 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);
21954 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21955 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21956 uint64_t ret_ref = (uint64_t)ret_var.inner;
21957 if (ret_var.is_owned) {
21963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21964 LDKChannelTransactionParameters orig_conv;
21965 orig_conv.inner = (void*)(orig & (~1));
21966 orig_conv.is_owned = false;
21967 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
21968 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21969 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21970 uint64_t ret_ref = (uint64_t)ret_var.inner;
21971 if (ret_var.is_owned) {
21977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21978 LDKCounterpartyChannelTransactionParameters this_obj_conv;
21979 this_obj_conv.inner = (void*)(this_obj & (~1));
21980 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21981 CounterpartyChannelTransactionParameters_free(this_obj_conv);
21984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21985 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21987 this_ptr_conv.is_owned = false;
21988 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
21989 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21990 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21991 uint64_t ret_ref = (uint64_t)ret_var.inner;
21992 if (ret_var.is_owned) {
21998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21999 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22001 this_ptr_conv.is_owned = false;
22002 LDKChannelPublicKeys val_conv;
22003 val_conv.inner = (void*)(val & (~1));
22004 val_conv.is_owned = (val & 1) || (val == 0);
22005 val_conv = ChannelPublicKeys_clone(&val_conv);
22006 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
22009 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
22010 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22012 this_ptr_conv.is_owned = false;
22013 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
22017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22018 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22020 this_ptr_conv.is_owned = false;
22021 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
22024 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) {
22025 LDKChannelPublicKeys pubkeys_arg_conv;
22026 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
22027 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
22028 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
22029 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
22030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22032 uint64_t ret_ref = (uint64_t)ret_var.inner;
22033 if (ret_var.is_owned) {
22039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22040 LDKCounterpartyChannelTransactionParameters orig_conv;
22041 orig_conv.inner = (void*)(orig & (~1));
22042 orig_conv.is_owned = false;
22043 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
22044 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22045 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22046 uint64_t ret_ref = (uint64_t)ret_var.inner;
22047 if (ret_var.is_owned) {
22053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
22054 LDKChannelTransactionParameters this_arg_conv;
22055 this_arg_conv.inner = (void*)(this_arg & (~1));
22056 this_arg_conv.is_owned = false;
22057 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
22061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
22062 LDKChannelTransactionParameters this_arg_conv;
22063 this_arg_conv.inner = (void*)(this_arg & (~1));
22064 this_arg_conv.is_owned = false;
22065 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
22066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22068 uint64_t ret_ref = (uint64_t)ret_var.inner;
22069 if (ret_var.is_owned) {
22075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
22076 LDKChannelTransactionParameters this_arg_conv;
22077 this_arg_conv.inner = (void*)(this_arg & (~1));
22078 this_arg_conv.is_owned = false;
22079 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
22080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22082 uint64_t ret_ref = (uint64_t)ret_var.inner;
22083 if (ret_var.is_owned) {
22089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
22090 LDKCounterpartyChannelTransactionParameters obj_conv;
22091 obj_conv.inner = (void*)(obj & (~1));
22092 obj_conv.is_owned = false;
22093 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
22094 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22095 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22096 CVec_u8Z_free(ret_var);
22100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22101 LDKu8slice ser_ref;
22102 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22103 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22104 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
22105 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
22106 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22107 return (uint64_t)ret_conv;
22110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
22111 LDKChannelTransactionParameters obj_conv;
22112 obj_conv.inner = (void*)(obj & (~1));
22113 obj_conv.is_owned = false;
22114 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
22115 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22116 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22117 CVec_u8Z_free(ret_var);
22121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22122 LDKu8slice ser_ref;
22123 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22124 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22125 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
22126 *ret_conv = ChannelTransactionParameters_read(ser_ref);
22127 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22128 return (uint64_t)ret_conv;
22131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22132 LDKDirectedChannelTransactionParameters this_obj_conv;
22133 this_obj_conv.inner = (void*)(this_obj & (~1));
22134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22135 DirectedChannelTransactionParameters_free(this_obj_conv);
22138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
22139 LDKDirectedChannelTransactionParameters this_arg_conv;
22140 this_arg_conv.inner = (void*)(this_arg & (~1));
22141 this_arg_conv.is_owned = false;
22142 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
22143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22145 uint64_t ret_ref = (uint64_t)ret_var.inner;
22146 if (ret_var.is_owned) {
22152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
22153 LDKDirectedChannelTransactionParameters this_arg_conv;
22154 this_arg_conv.inner = (void*)(this_arg & (~1));
22155 this_arg_conv.is_owned = false;
22156 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
22157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22159 uint64_t ret_ref = (uint64_t)ret_var.inner;
22160 if (ret_var.is_owned) {
22166 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
22167 LDKDirectedChannelTransactionParameters this_arg_conv;
22168 this_arg_conv.inner = (void*)(this_arg & (~1));
22169 this_arg_conv.is_owned = false;
22170 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
22174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
22175 LDKDirectedChannelTransactionParameters this_arg_conv;
22176 this_arg_conv.inner = (void*)(this_arg & (~1));
22177 this_arg_conv.is_owned = false;
22178 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
22182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
22183 LDKDirectedChannelTransactionParameters this_arg_conv;
22184 this_arg_conv.inner = (void*)(this_arg & (~1));
22185 this_arg_conv.is_owned = false;
22186 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
22187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22189 uint64_t ret_ref = (uint64_t)ret_var.inner;
22190 if (ret_var.is_owned) {
22196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22197 LDKHolderCommitmentTransaction this_obj_conv;
22198 this_obj_conv.inner = (void*)(this_obj & (~1));
22199 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22200 HolderCommitmentTransaction_free(this_obj_conv);
22203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
22204 LDKHolderCommitmentTransaction this_ptr_conv;
22205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22206 this_ptr_conv.is_owned = false;
22207 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22208 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
22212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22213 LDKHolderCommitmentTransaction this_ptr_conv;
22214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22215 this_ptr_conv.is_owned = false;
22216 LDKSignature val_ref;
22217 CHECK((*env)->GetArrayLength(env, val) == 64);
22218 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22219 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
22222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
22223 LDKHolderCommitmentTransaction this_ptr_conv;
22224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22225 this_ptr_conv.is_owned = false;
22226 LDKCVec_SignatureZ val_constr;
22227 val_constr.datalen = (*env)->GetArrayLength(env, val);
22228 if (val_constr.datalen > 0)
22229 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22231 val_constr.data = NULL;
22232 for (size_t i = 0; i < val_constr.datalen; i++) {
22233 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
22234 LDKSignature val_conv_8_ref;
22235 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
22236 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
22237 val_constr.data[i] = val_conv_8_ref;
22239 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
22242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22243 LDKHolderCommitmentTransaction orig_conv;
22244 orig_conv.inner = (void*)(orig & (~1));
22245 orig_conv.is_owned = false;
22246 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
22247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22249 uint64_t ret_ref = (uint64_t)ret_var.inner;
22250 if (ret_var.is_owned) {
22256 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22257 LDKHolderCommitmentTransaction obj_conv;
22258 obj_conv.inner = (void*)(obj & (~1));
22259 obj_conv.is_owned = false;
22260 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
22261 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22262 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22263 CVec_u8Z_free(ret_var);
22267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22268 LDKu8slice ser_ref;
22269 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22270 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22271 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
22272 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
22273 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22274 return (uint64_t)ret_conv;
22277 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) {
22278 LDKCommitmentTransaction commitment_tx_conv;
22279 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
22280 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
22281 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
22282 LDKSignature counterparty_sig_ref;
22283 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
22284 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
22285 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
22286 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
22287 if (counterparty_htlc_sigs_constr.datalen > 0)
22288 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22290 counterparty_htlc_sigs_constr.data = NULL;
22291 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
22292 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
22293 LDKSignature counterparty_htlc_sigs_conv_8_ref;
22294 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
22295 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
22296 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
22298 LDKPublicKey holder_funding_key_ref;
22299 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
22300 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
22301 LDKPublicKey counterparty_funding_key_ref;
22302 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
22303 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
22304 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22306 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22307 uint64_t ret_ref = (uint64_t)ret_var.inner;
22308 if (ret_var.is_owned) {
22314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22315 LDKBuiltCommitmentTransaction this_obj_conv;
22316 this_obj_conv.inner = (void*)(this_obj & (~1));
22317 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22318 BuiltCommitmentTransaction_free(this_obj_conv);
22321 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
22322 LDKBuiltCommitmentTransaction this_ptr_conv;
22323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22324 this_ptr_conv.is_owned = false;
22325 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22326 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22327 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22328 Transaction_free(ret_var);
22332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22333 LDKBuiltCommitmentTransaction this_ptr_conv;
22334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22335 this_ptr_conv.is_owned = false;
22336 LDKTransaction val_ref;
22337 val_ref.datalen = (*env)->GetArrayLength(env, val);
22338 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22339 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
22340 val_ref.data_is_owned = true;
22341 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
22345 LDKBuiltCommitmentTransaction this_ptr_conv;
22346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22347 this_ptr_conv.is_owned = false;
22348 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22349 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
22353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22354 LDKBuiltCommitmentTransaction this_ptr_conv;
22355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22356 this_ptr_conv.is_owned = false;
22357 LDKThirtyTwoBytes val_ref;
22358 CHECK((*env)->GetArrayLength(env, val) == 32);
22359 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22360 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
22364 LDKTransaction transaction_arg_ref;
22365 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
22366 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22367 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
22368 transaction_arg_ref.data_is_owned = true;
22369 LDKThirtyTwoBytes txid_arg_ref;
22370 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
22371 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
22372 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22373 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22374 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22375 uint64_t ret_ref = (uint64_t)ret_var.inner;
22376 if (ret_var.is_owned) {
22382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22383 LDKBuiltCommitmentTransaction orig_conv;
22384 orig_conv.inner = (void*)(orig & (~1));
22385 orig_conv.is_owned = false;
22386 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
22387 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22388 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22389 uint64_t ret_ref = (uint64_t)ret_var.inner;
22390 if (ret_var.is_owned) {
22396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22397 LDKBuiltCommitmentTransaction obj_conv;
22398 obj_conv.inner = (void*)(obj & (~1));
22399 obj_conv.is_owned = false;
22400 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
22401 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22402 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22403 CVec_u8Z_free(ret_var);
22407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22408 LDKu8slice ser_ref;
22409 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22410 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22411 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
22412 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
22413 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22414 return (uint64_t)ret_conv;
22417 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) {
22418 LDKBuiltCommitmentTransaction this_arg_conv;
22419 this_arg_conv.inner = (void*)(this_arg & (~1));
22420 this_arg_conv.is_owned = false;
22421 LDKu8slice funding_redeemscript_ref;
22422 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22423 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22424 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22425 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
22426 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22430 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) {
22431 LDKBuiltCommitmentTransaction this_arg_conv;
22432 this_arg_conv.inner = (void*)(this_arg & (~1));
22433 this_arg_conv.is_owned = false;
22434 unsigned char funding_key_arr[32];
22435 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
22436 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
22437 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22438 LDKu8slice funding_redeemscript_ref;
22439 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22440 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22441 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22442 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
22443 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22448 LDKCommitmentTransaction this_obj_conv;
22449 this_obj_conv.inner = (void*)(this_obj & (~1));
22450 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22451 CommitmentTransaction_free(this_obj_conv);
22454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22455 LDKCommitmentTransaction orig_conv;
22456 orig_conv.inner = (void*)(orig & (~1));
22457 orig_conv.is_owned = false;
22458 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
22459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22461 uint64_t ret_ref = (uint64_t)ret_var.inner;
22462 if (ret_var.is_owned) {
22468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22469 LDKCommitmentTransaction obj_conv;
22470 obj_conv.inner = (void*)(obj & (~1));
22471 obj_conv.is_owned = false;
22472 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
22473 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22474 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22475 CVec_u8Z_free(ret_var);
22479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22480 LDKu8slice ser_ref;
22481 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22482 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22483 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
22484 *ret_conv = CommitmentTransaction_read(ser_ref);
22485 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22486 return (uint64_t)ret_conv;
22489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
22490 LDKCommitmentTransaction this_arg_conv;
22491 this_arg_conv.inner = (void*)(this_arg & (~1));
22492 this_arg_conv.is_owned = false;
22493 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
22497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22498 LDKCommitmentTransaction this_arg_conv;
22499 this_arg_conv.inner = (void*)(this_arg & (~1));
22500 this_arg_conv.is_owned = false;
22501 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
22505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22506 LDKCommitmentTransaction this_arg_conv;
22507 this_arg_conv.inner = (void*)(this_arg & (~1));
22508 this_arg_conv.is_owned = false;
22509 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
22513 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
22514 LDKCommitmentTransaction this_arg_conv;
22515 this_arg_conv.inner = (void*)(this_arg & (~1));
22516 this_arg_conv.is_owned = false;
22517 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
22521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
22522 LDKCommitmentTransaction this_arg_conv;
22523 this_arg_conv.inner = (void*)(this_arg & (~1));
22524 this_arg_conv.is_owned = false;
22525 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
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 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) {
22536 LDKCommitmentTransaction this_arg_conv;
22537 this_arg_conv.inner = (void*)(this_arg & (~1));
22538 this_arg_conv.is_owned = false;
22539 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22540 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22541 channel_parameters_conv.is_owned = false;
22542 LDKChannelPublicKeys broadcaster_keys_conv;
22543 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22544 broadcaster_keys_conv.is_owned = false;
22545 LDKChannelPublicKeys countersignatory_keys_conv;
22546 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22547 countersignatory_keys_conv.is_owned = false;
22548 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
22549 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
22550 return (uint64_t)ret_conv;
22553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22554 LDKTrustedCommitmentTransaction this_obj_conv;
22555 this_obj_conv.inner = (void*)(this_obj & (~1));
22556 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22557 TrustedCommitmentTransaction_free(this_obj_conv);
22560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
22561 LDKTrustedCommitmentTransaction this_arg_conv;
22562 this_arg_conv.inner = (void*)(this_arg & (~1));
22563 this_arg_conv.is_owned = false;
22564 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22565 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
22569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
22570 LDKTrustedCommitmentTransaction this_arg_conv;
22571 this_arg_conv.inner = (void*)(this_arg & (~1));
22572 this_arg_conv.is_owned = false;
22573 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
22574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22576 uint64_t ret_ref = (uint64_t)ret_var.inner;
22577 if (ret_var.is_owned) {
22583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
22584 LDKTrustedCommitmentTransaction this_arg_conv;
22585 this_arg_conv.inner = (void*)(this_arg & (~1));
22586 this_arg_conv.is_owned = false;
22587 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
22588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22590 uint64_t ret_ref = (uint64_t)ret_var.inner;
22591 if (ret_var.is_owned) {
22597 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) {
22598 LDKTrustedCommitmentTransaction this_arg_conv;
22599 this_arg_conv.inner = (void*)(this_arg & (~1));
22600 this_arg_conv.is_owned = false;
22601 unsigned char htlc_base_key_arr[32];
22602 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
22603 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
22604 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
22605 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22606 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22607 channel_parameters_conv.is_owned = false;
22608 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
22609 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
22610 return (uint64_t)ret_conv;
22613 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) {
22614 LDKPublicKey broadcaster_payment_basepoint_ref;
22615 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
22616 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
22617 LDKPublicKey countersignatory_payment_basepoint_ref;
22618 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
22619 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
22620 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
22624 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22625 LDKInitFeatures a_conv;
22626 a_conv.inner = (void*)(a & (~1));
22627 a_conv.is_owned = false;
22628 LDKInitFeatures b_conv;
22629 b_conv.inner = (void*)(b & (~1));
22630 b_conv.is_owned = false;
22631 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
22635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22636 LDKNodeFeatures a_conv;
22637 a_conv.inner = (void*)(a & (~1));
22638 a_conv.is_owned = false;
22639 LDKNodeFeatures b_conv;
22640 b_conv.inner = (void*)(b & (~1));
22641 b_conv.is_owned = false;
22642 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
22646 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22647 LDKChannelFeatures a_conv;
22648 a_conv.inner = (void*)(a & (~1));
22649 a_conv.is_owned = false;
22650 LDKChannelFeatures b_conv;
22651 b_conv.inner = (void*)(b & (~1));
22652 b_conv.is_owned = false;
22653 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
22657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22658 LDKInvoiceFeatures a_conv;
22659 a_conv.inner = (void*)(a & (~1));
22660 a_conv.is_owned = false;
22661 LDKInvoiceFeatures b_conv;
22662 b_conv.inner = (void*)(b & (~1));
22663 b_conv.is_owned = false;
22664 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
22668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22669 LDKInitFeatures orig_conv;
22670 orig_conv.inner = (void*)(orig & (~1));
22671 orig_conv.is_owned = false;
22672 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
22673 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22674 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22675 uint64_t ret_ref = (uint64_t)ret_var.inner;
22676 if (ret_var.is_owned) {
22682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22683 LDKNodeFeatures orig_conv;
22684 orig_conv.inner = (void*)(orig & (~1));
22685 orig_conv.is_owned = false;
22686 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
22687 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22688 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22689 uint64_t ret_ref = (uint64_t)ret_var.inner;
22690 if (ret_var.is_owned) {
22696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22697 LDKChannelFeatures orig_conv;
22698 orig_conv.inner = (void*)(orig & (~1));
22699 orig_conv.is_owned = false;
22700 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
22701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22703 uint64_t ret_ref = (uint64_t)ret_var.inner;
22704 if (ret_var.is_owned) {
22710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22711 LDKInvoiceFeatures orig_conv;
22712 orig_conv.inner = (void*)(orig & (~1));
22713 orig_conv.is_owned = false;
22714 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
22715 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22716 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22717 uint64_t ret_ref = (uint64_t)ret_var.inner;
22718 if (ret_var.is_owned) {
22724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22725 LDKInitFeatures this_obj_conv;
22726 this_obj_conv.inner = (void*)(this_obj & (~1));
22727 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22728 InitFeatures_free(this_obj_conv);
22731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22732 LDKNodeFeatures this_obj_conv;
22733 this_obj_conv.inner = (void*)(this_obj & (~1));
22734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22735 NodeFeatures_free(this_obj_conv);
22738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22739 LDKChannelFeatures this_obj_conv;
22740 this_obj_conv.inner = (void*)(this_obj & (~1));
22741 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22742 ChannelFeatures_free(this_obj_conv);
22745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22746 LDKInvoiceFeatures this_obj_conv;
22747 this_obj_conv.inner = (void*)(this_obj & (~1));
22748 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22749 InvoiceFeatures_free(this_obj_conv);
22752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
22753 LDKInitFeatures ret_var = InitFeatures_empty();
22754 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22755 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22756 uint64_t ret_ref = (uint64_t)ret_var.inner;
22757 if (ret_var.is_owned) {
22763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
22764 LDKInitFeatures ret_var = InitFeatures_known();
22765 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22766 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22767 uint64_t ret_ref = (uint64_t)ret_var.inner;
22768 if (ret_var.is_owned) {
22774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
22775 LDKNodeFeatures ret_var = NodeFeatures_empty();
22776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22778 uint64_t ret_ref = (uint64_t)ret_var.inner;
22779 if (ret_var.is_owned) {
22785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
22786 LDKNodeFeatures ret_var = NodeFeatures_known();
22787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22789 uint64_t ret_ref = (uint64_t)ret_var.inner;
22790 if (ret_var.is_owned) {
22796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
22797 LDKChannelFeatures ret_var = ChannelFeatures_empty();
22798 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22799 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22800 uint64_t ret_ref = (uint64_t)ret_var.inner;
22801 if (ret_var.is_owned) {
22807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
22808 LDKChannelFeatures ret_var = ChannelFeatures_known();
22809 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22810 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22811 uint64_t ret_ref = (uint64_t)ret_var.inner;
22812 if (ret_var.is_owned) {
22818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
22819 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
22820 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22821 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22822 uint64_t ret_ref = (uint64_t)ret_var.inner;
22823 if (ret_var.is_owned) {
22829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
22830 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
22831 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22832 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22833 uint64_t ret_ref = (uint64_t)ret_var.inner;
22834 if (ret_var.is_owned) {
22840 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22841 LDKInitFeatures this_arg_conv;
22842 this_arg_conv.inner = (void*)(this_arg & (~1));
22843 this_arg_conv.is_owned = false;
22844 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
22848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22849 LDKNodeFeatures this_arg_conv;
22850 this_arg_conv.inner = (void*)(this_arg & (~1));
22851 this_arg_conv.is_owned = false;
22852 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
22856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22857 LDKInvoiceFeatures this_arg_conv;
22858 this_arg_conv.inner = (void*)(this_arg & (~1));
22859 this_arg_conv.is_owned = false;
22860 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
22864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22865 LDKInitFeatures obj_conv;
22866 obj_conv.inner = (void*)(obj & (~1));
22867 obj_conv.is_owned = false;
22868 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
22869 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22870 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22871 CVec_u8Z_free(ret_var);
22875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22876 LDKNodeFeatures obj_conv;
22877 obj_conv.inner = (void*)(obj & (~1));
22878 obj_conv.is_owned = false;
22879 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
22880 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22881 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22882 CVec_u8Z_free(ret_var);
22886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22887 LDKChannelFeatures obj_conv;
22888 obj_conv.inner = (void*)(obj & (~1));
22889 obj_conv.is_owned = false;
22890 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
22891 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22892 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22893 CVec_u8Z_free(ret_var);
22897 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22898 LDKInvoiceFeatures obj_conv;
22899 obj_conv.inner = (void*)(obj & (~1));
22900 obj_conv.is_owned = false;
22901 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
22902 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22903 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22904 CVec_u8Z_free(ret_var);
22908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22909 LDKu8slice ser_ref;
22910 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22911 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22912 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22913 *ret_conv = InitFeatures_read(ser_ref);
22914 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22915 return (uint64_t)ret_conv;
22918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22919 LDKu8slice ser_ref;
22920 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22921 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22922 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22923 *ret_conv = NodeFeatures_read(ser_ref);
22924 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22925 return (uint64_t)ret_conv;
22928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22929 LDKu8slice ser_ref;
22930 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22931 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22932 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22933 *ret_conv = ChannelFeatures_read(ser_ref);
22934 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22935 return (uint64_t)ret_conv;
22938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22939 LDKu8slice ser_ref;
22940 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22941 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22942 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
22943 *ret_conv = InvoiceFeatures_read(ser_ref);
22944 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22945 return (uint64_t)ret_conv;
22948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22949 LDKRouteHop this_obj_conv;
22950 this_obj_conv.inner = (void*)(this_obj & (~1));
22951 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22952 RouteHop_free(this_obj_conv);
22955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22956 LDKRouteHop this_ptr_conv;
22957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22958 this_ptr_conv.is_owned = false;
22959 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22960 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
22964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22965 LDKRouteHop this_ptr_conv;
22966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22967 this_ptr_conv.is_owned = false;
22968 LDKPublicKey val_ref;
22969 CHECK((*env)->GetArrayLength(env, val) == 33);
22970 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22971 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
22974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22975 LDKRouteHop this_ptr_conv;
22976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22977 this_ptr_conv.is_owned = false;
22978 LDKNodeFeatures ret_var = RouteHop_get_node_features(&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_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22989 LDKRouteHop this_ptr_conv;
22990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22991 this_ptr_conv.is_owned = false;
22992 LDKNodeFeatures val_conv;
22993 val_conv.inner = (void*)(val & (~1));
22994 val_conv.is_owned = (val & 1) || (val == 0);
22995 val_conv = NodeFeatures_clone(&val_conv);
22996 RouteHop_set_node_features(&this_ptr_conv, val_conv);
22999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23000 LDKRouteHop this_ptr_conv;
23001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23002 this_ptr_conv.is_owned = false;
23003 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
23007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23008 LDKRouteHop this_ptr_conv;
23009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23010 this_ptr_conv.is_owned = false;
23011 RouteHop_set_short_channel_id(&this_ptr_conv, val);
23014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23015 LDKRouteHop this_ptr_conv;
23016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23017 this_ptr_conv.is_owned = false;
23018 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
23019 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23020 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23021 uint64_t ret_ref = (uint64_t)ret_var.inner;
23022 if (ret_var.is_owned) {
23028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23029 LDKRouteHop this_ptr_conv;
23030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23031 this_ptr_conv.is_owned = false;
23032 LDKChannelFeatures val_conv;
23033 val_conv.inner = (void*)(val & (~1));
23034 val_conv.is_owned = (val & 1) || (val == 0);
23035 val_conv = ChannelFeatures_clone(&val_conv);
23036 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
23039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23040 LDKRouteHop this_ptr_conv;
23041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23042 this_ptr_conv.is_owned = false;
23043 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
23047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23048 LDKRouteHop this_ptr_conv;
23049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23050 this_ptr_conv.is_owned = false;
23051 RouteHop_set_fee_msat(&this_ptr_conv, val);
23054 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23055 LDKRouteHop this_ptr_conv;
23056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23057 this_ptr_conv.is_owned = false;
23058 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
23062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23063 LDKRouteHop this_ptr_conv;
23064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23065 this_ptr_conv.is_owned = false;
23066 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23069 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) {
23070 LDKPublicKey pubkey_arg_ref;
23071 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
23072 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
23073 LDKNodeFeatures node_features_arg_conv;
23074 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
23075 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
23076 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
23077 LDKChannelFeatures channel_features_arg_conv;
23078 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
23079 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
23080 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
23081 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);
23082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23084 uint64_t ret_ref = (uint64_t)ret_var.inner;
23085 if (ret_var.is_owned) {
23091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23092 LDKRouteHop orig_conv;
23093 orig_conv.inner = (void*)(orig & (~1));
23094 orig_conv.is_owned = false;
23095 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
23096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23098 uint64_t ret_ref = (uint64_t)ret_var.inner;
23099 if (ret_var.is_owned) {
23105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
23106 LDKRouteHop obj_conv;
23107 obj_conv.inner = (void*)(obj & (~1));
23108 obj_conv.is_owned = false;
23109 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
23110 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23111 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23112 CVec_u8Z_free(ret_var);
23116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23117 LDKu8slice ser_ref;
23118 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23119 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23120 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
23121 *ret_conv = RouteHop_read(ser_ref);
23122 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23123 return (uint64_t)ret_conv;
23126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23127 LDKRoute this_obj_conv;
23128 this_obj_conv.inner = (void*)(this_obj & (~1));
23129 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23130 Route_free(this_obj_conv);
23133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
23134 LDKRoute this_ptr_conv;
23135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23136 this_ptr_conv.is_owned = false;
23137 LDKCVec_CVec_RouteHopZZ val_constr;
23138 val_constr.datalen = (*env)->GetArrayLength(env, val);
23139 if (val_constr.datalen > 0)
23140 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23142 val_constr.data = NULL;
23143 for (size_t m = 0; m < val_constr.datalen; m++) {
23144 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
23145 LDKCVec_RouteHopZ val_conv_12_constr;
23146 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
23147 if (val_conv_12_constr.datalen > 0)
23148 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23150 val_conv_12_constr.data = NULL;
23151 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
23152 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
23153 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
23154 LDKRouteHop val_conv_12_conv_10_conv;
23155 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
23156 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
23157 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
23158 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
23160 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
23161 val_constr.data[m] = val_conv_12_constr;
23163 Route_set_paths(&this_ptr_conv, val_constr);
23166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
23167 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
23168 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
23169 if (paths_arg_constr.datalen > 0)
23170 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23172 paths_arg_constr.data = NULL;
23173 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
23174 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
23175 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
23176 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
23177 if (paths_arg_conv_12_constr.datalen > 0)
23178 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23180 paths_arg_conv_12_constr.data = NULL;
23181 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
23182 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
23183 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
23184 LDKRouteHop paths_arg_conv_12_conv_10_conv;
23185 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
23186 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
23187 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
23188 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
23190 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
23191 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
23193 LDKRoute ret_var = Route_new(paths_arg_constr);
23194 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23195 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23196 uint64_t ret_ref = (uint64_t)ret_var.inner;
23197 if (ret_var.is_owned) {
23203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23204 LDKRoute orig_conv;
23205 orig_conv.inner = (void*)(orig & (~1));
23206 orig_conv.is_owned = false;
23207 LDKRoute ret_var = Route_clone(&orig_conv);
23208 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23209 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23210 uint64_t ret_ref = (uint64_t)ret_var.inner;
23211 if (ret_var.is_owned) {
23217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
23219 obj_conv.inner = (void*)(obj & (~1));
23220 obj_conv.is_owned = false;
23221 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
23222 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23223 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23224 CVec_u8Z_free(ret_var);
23228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23229 LDKu8slice ser_ref;
23230 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23231 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23232 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23233 *ret_conv = Route_read(ser_ref);
23234 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23235 return (uint64_t)ret_conv;
23238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23239 LDKRouteHint this_obj_conv;
23240 this_obj_conv.inner = (void*)(this_obj & (~1));
23241 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23242 RouteHint_free(this_obj_conv);
23245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23246 LDKRouteHint a_conv;
23247 a_conv.inner = (void*)(a & (~1));
23248 a_conv.is_owned = false;
23249 LDKRouteHint b_conv;
23250 b_conv.inner = (void*)(b & (~1));
23251 b_conv.is_owned = false;
23252 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
23256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23257 LDKRouteHint orig_conv;
23258 orig_conv.inner = (void*)(orig & (~1));
23259 orig_conv.is_owned = false;
23260 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
23261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23263 uint64_t ret_ref = (uint64_t)ret_var.inner;
23264 if (ret_var.is_owned) {
23270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23271 LDKRouteHintHop this_obj_conv;
23272 this_obj_conv.inner = (void*)(this_obj & (~1));
23273 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23274 RouteHintHop_free(this_obj_conv);
23277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23278 LDKRouteHintHop this_ptr_conv;
23279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23280 this_ptr_conv.is_owned = false;
23281 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23282 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
23286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23287 LDKRouteHintHop this_ptr_conv;
23288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23289 this_ptr_conv.is_owned = false;
23290 LDKPublicKey val_ref;
23291 CHECK((*env)->GetArrayLength(env, val) == 33);
23292 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23293 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
23296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23297 LDKRouteHintHop this_ptr_conv;
23298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23299 this_ptr_conv.is_owned = false;
23300 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
23304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23305 LDKRouteHintHop this_ptr_conv;
23306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23307 this_ptr_conv.is_owned = false;
23308 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
23311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23312 LDKRouteHintHop this_ptr_conv;
23313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23314 this_ptr_conv.is_owned = false;
23315 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
23316 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23317 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23318 uint64_t ret_ref = (uint64_t)ret_var.inner;
23319 if (ret_var.is_owned) {
23325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23326 LDKRouteHintHop this_ptr_conv;
23327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23328 this_ptr_conv.is_owned = false;
23329 LDKRoutingFees val_conv;
23330 val_conv.inner = (void*)(val & (~1));
23331 val_conv.is_owned = (val & 1) || (val == 0);
23332 val_conv = RoutingFees_clone(&val_conv);
23333 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
23336 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23337 LDKRouteHintHop this_ptr_conv;
23338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23339 this_ptr_conv.is_owned = false;
23340 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
23344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23345 LDKRouteHintHop this_ptr_conv;
23346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23347 this_ptr_conv.is_owned = false;
23348 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23352 LDKRouteHintHop this_ptr_conv;
23353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23354 this_ptr_conv.is_owned = false;
23355 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23356 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
23357 uint64_t ret_ref = (uint64_t)ret_copy;
23361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23362 LDKRouteHintHop this_ptr_conv;
23363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23364 this_ptr_conv.is_owned = false;
23365 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23366 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
23369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23370 LDKRouteHintHop this_ptr_conv;
23371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23372 this_ptr_conv.is_owned = false;
23373 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23374 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
23375 uint64_t ret_ref = (uint64_t)ret_copy;
23379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23380 LDKRouteHintHop this_ptr_conv;
23381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23382 this_ptr_conv.is_owned = false;
23383 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23384 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23387 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) {
23388 LDKPublicKey src_node_id_arg_ref;
23389 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
23390 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
23391 LDKRoutingFees fees_arg_conv;
23392 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23393 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23394 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23395 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
23396 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23397 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);
23398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23400 uint64_t ret_ref = (uint64_t)ret_var.inner;
23401 if (ret_var.is_owned) {
23407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23408 LDKRouteHintHop a_conv;
23409 a_conv.inner = (void*)(a & (~1));
23410 a_conv.is_owned = false;
23411 LDKRouteHintHop b_conv;
23412 b_conv.inner = (void*)(b & (~1));
23413 b_conv.is_owned = false;
23414 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
23418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23419 LDKRouteHintHop orig_conv;
23420 orig_conv.inner = (void*)(orig & (~1));
23421 orig_conv.is_owned = false;
23422 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
23423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23425 uint64_t ret_ref = (uint64_t)ret_var.inner;
23426 if (ret_var.is_owned) {
23432 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) {
23433 LDKPublicKey our_node_id_ref;
23434 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
23435 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
23436 LDKNetworkGraph network_conv;
23437 network_conv.inner = (void*)(network & (~1));
23438 network_conv.is_owned = false;
23439 LDKPublicKey payee_ref;
23440 CHECK((*env)->GetArrayLength(env, payee) == 33);
23441 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
23442 LDKInvoiceFeatures payee_features_conv;
23443 payee_features_conv.inner = (void*)(payee_features & (~1));
23444 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
23445 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
23446 LDKCVec_ChannelDetailsZ first_hops_constr;
23447 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
23448 if (first_hops_constr.datalen > 0)
23449 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23451 first_hops_constr.data = NULL;
23452 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
23453 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23454 int64_t first_hops_conv_16 = first_hops_vals[q];
23455 LDKChannelDetails first_hops_conv_16_conv;
23456 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23457 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23458 first_hops_constr.data[q] = first_hops_conv_16_conv;
23460 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
23461 LDKCVec_RouteHintZ last_hops_constr;
23462 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
23463 if (last_hops_constr.datalen > 0)
23464 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23466 last_hops_constr.data = NULL;
23467 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
23468 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23469 int64_t last_hops_conv_11 = last_hops_vals[l];
23470 LDKRouteHint last_hops_conv_11_conv;
23471 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23472 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23473 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23474 last_hops_constr.data[l] = last_hops_conv_11_conv;
23476 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
23477 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23478 if (logger_conv.free == LDKLogger_JCalls_free) {
23479 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23480 LDKLogger_JCalls_clone(logger_conv.this_arg);
23482 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23483 *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);
23484 FREE(first_hops_constr.data);
23485 return (uint64_t)ret_conv;
23488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23489 LDKNetworkGraph this_obj_conv;
23490 this_obj_conv.inner = (void*)(this_obj & (~1));
23491 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23492 NetworkGraph_free(this_obj_conv);
23495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23496 LDKNetworkGraph orig_conv;
23497 orig_conv.inner = (void*)(orig & (~1));
23498 orig_conv.is_owned = false;
23499 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
23500 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23501 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23502 uint64_t ret_ref = (uint64_t)ret_var.inner;
23503 if (ret_var.is_owned) {
23509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23510 LDKLockedNetworkGraph this_obj_conv;
23511 this_obj_conv.inner = (void*)(this_obj & (~1));
23512 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23513 LockedNetworkGraph_free(this_obj_conv);
23516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23517 LDKNetGraphMsgHandler this_obj_conv;
23518 this_obj_conv.inner = (void*)(this_obj & (~1));
23519 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23520 NetGraphMsgHandler_free(this_obj_conv);
23523 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) {
23524 LDKThirtyTwoBytes genesis_hash_ref;
23525 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
23526 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
23527 LDKAccess *chain_access_conv_ptr = NULL;
23528 if (chain_access != 0) {
23529 LDKAccess chain_access_conv;
23530 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23531 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23532 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23533 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23535 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23536 *chain_access_conv_ptr = chain_access_conv;
23538 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23539 if (logger_conv.free == LDKLogger_JCalls_free) {
23540 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23541 LDKLogger_JCalls_clone(logger_conv.this_arg);
23543 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
23544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23546 uint64_t ret_ref = (uint64_t)ret_var.inner;
23547 if (ret_var.is_owned) {
23553 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) {
23554 LDKAccess *chain_access_conv_ptr = NULL;
23555 if (chain_access != 0) {
23556 LDKAccess chain_access_conv;
23557 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23558 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23559 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23560 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23562 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23563 *chain_access_conv_ptr = chain_access_conv;
23565 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23566 if (logger_conv.free == LDKLogger_JCalls_free) {
23567 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23568 LDKLogger_JCalls_clone(logger_conv.this_arg);
23570 LDKNetworkGraph network_graph_conv;
23571 network_graph_conv.inner = (void*)(network_graph & (~1));
23572 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
23573 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
23574 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
23575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23577 uint64_t ret_ref = (uint64_t)ret_var.inner;
23578 if (ret_var.is_owned) {
23584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
23585 LDKNetGraphMsgHandler this_arg_conv;
23586 this_arg_conv.inner = (void*)(this_arg & (~1));
23587 this_arg_conv.is_owned = false;
23588 LDKAccess *chain_access_conv_ptr = NULL;
23589 if (chain_access != 0) {
23590 LDKAccess chain_access_conv;
23591 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23592 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23593 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23594 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23596 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23597 *chain_access_conv_ptr = chain_access_conv;
23599 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
23602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23603 LDKNetGraphMsgHandler this_arg_conv;
23604 this_arg_conv.inner = (void*)(this_arg & (~1));
23605 this_arg_conv.is_owned = false;
23606 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
23607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23609 uint64_t ret_ref = (uint64_t)ret_var.inner;
23610 if (ret_var.is_owned) {
23616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23617 LDKLockedNetworkGraph this_arg_conv;
23618 this_arg_conv.inner = (void*)(this_arg & (~1));
23619 this_arg_conv.is_owned = false;
23620 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
23621 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23622 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23623 uint64_t ret_ref = (uint64_t)ret_var.inner;
23624 if (ret_var.is_owned) {
23630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23631 LDKNetGraphMsgHandler this_arg_conv;
23632 this_arg_conv.inner = (void*)(this_arg & (~1));
23633 this_arg_conv.is_owned = false;
23634 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23635 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
23636 return (uint64_t)ret;
23639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23640 LDKNetGraphMsgHandler this_arg_conv;
23641 this_arg_conv.inner = (void*)(this_arg & (~1));
23642 this_arg_conv.is_owned = false;
23643 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23644 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
23645 return (uint64_t)ret;
23648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23649 LDKDirectionalChannelInfo this_obj_conv;
23650 this_obj_conv.inner = (void*)(this_obj & (~1));
23651 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23652 DirectionalChannelInfo_free(this_obj_conv);
23655 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
23656 LDKDirectionalChannelInfo this_ptr_conv;
23657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23658 this_ptr_conv.is_owned = false;
23659 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
23663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23664 LDKDirectionalChannelInfo this_ptr_conv;
23665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23666 this_ptr_conv.is_owned = false;
23667 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
23670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
23671 LDKDirectionalChannelInfo this_ptr_conv;
23672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23673 this_ptr_conv.is_owned = false;
23674 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
23678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23679 LDKDirectionalChannelInfo this_ptr_conv;
23680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23681 this_ptr_conv.is_owned = false;
23682 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
23685 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23686 LDKDirectionalChannelInfo this_ptr_conv;
23687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23688 this_ptr_conv.is_owned = false;
23689 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
23693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23694 LDKDirectionalChannelInfo this_ptr_conv;
23695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23696 this_ptr_conv.is_owned = false;
23697 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
23700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23701 LDKDirectionalChannelInfo this_ptr_conv;
23702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23703 this_ptr_conv.is_owned = false;
23704 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
23708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23709 LDKDirectionalChannelInfo this_ptr_conv;
23710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23711 this_ptr_conv.is_owned = false;
23712 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
23715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23716 LDKDirectionalChannelInfo this_ptr_conv;
23717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23718 this_ptr_conv.is_owned = false;
23719 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23720 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
23721 uint64_t ret_ref = (uint64_t)ret_copy;
23725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23726 LDKDirectionalChannelInfo this_ptr_conv;
23727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23728 this_ptr_conv.is_owned = false;
23729 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23730 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23734 LDKDirectionalChannelInfo this_ptr_conv;
23735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23736 this_ptr_conv.is_owned = false;
23737 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
23738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23740 uint64_t ret_ref = (uint64_t)ret_var.inner;
23741 if (ret_var.is_owned) {
23747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23748 LDKDirectionalChannelInfo this_ptr_conv;
23749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23750 this_ptr_conv.is_owned = false;
23751 LDKRoutingFees val_conv;
23752 val_conv.inner = (void*)(val & (~1));
23753 val_conv.is_owned = (val & 1) || (val == 0);
23754 val_conv = RoutingFees_clone(&val_conv);
23755 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
23758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23759 LDKDirectionalChannelInfo this_ptr_conv;
23760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23761 this_ptr_conv.is_owned = false;
23762 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
23763 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23764 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23765 uint64_t ret_ref = (uint64_t)ret_var.inner;
23766 if (ret_var.is_owned) {
23772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23773 LDKDirectionalChannelInfo this_ptr_conv;
23774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23775 this_ptr_conv.is_owned = false;
23776 LDKChannelUpdate val_conv;
23777 val_conv.inner = (void*)(val & (~1));
23778 val_conv.is_owned = (val & 1) || (val == 0);
23779 val_conv = ChannelUpdate_clone(&val_conv);
23780 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
23783 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) {
23784 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23785 LDKRoutingFees fees_arg_conv;
23786 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23787 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23788 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23789 LDKChannelUpdate last_update_message_arg_conv;
23790 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
23791 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
23792 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
23793 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);
23794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23796 uint64_t ret_ref = (uint64_t)ret_var.inner;
23797 if (ret_var.is_owned) {
23803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23804 LDKDirectionalChannelInfo orig_conv;
23805 orig_conv.inner = (void*)(orig & (~1));
23806 orig_conv.is_owned = false;
23807 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
23808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23810 uint64_t ret_ref = (uint64_t)ret_var.inner;
23811 if (ret_var.is_owned) {
23817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
23818 LDKDirectionalChannelInfo obj_conv;
23819 obj_conv.inner = (void*)(obj & (~1));
23820 obj_conv.is_owned = false;
23821 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
23822 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23823 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23824 CVec_u8Z_free(ret_var);
23828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23829 LDKu8slice ser_ref;
23830 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23831 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23832 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
23833 *ret_conv = DirectionalChannelInfo_read(ser_ref);
23834 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23835 return (uint64_t)ret_conv;
23838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23839 LDKChannelInfo this_obj_conv;
23840 this_obj_conv.inner = (void*)(this_obj & (~1));
23841 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23842 ChannelInfo_free(this_obj_conv);
23845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23846 LDKChannelInfo this_ptr_conv;
23847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23848 this_ptr_conv.is_owned = false;
23849 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
23850 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23851 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23852 uint64_t ret_ref = (uint64_t)ret_var.inner;
23853 if (ret_var.is_owned) {
23859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23860 LDKChannelInfo this_ptr_conv;
23861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23862 this_ptr_conv.is_owned = false;
23863 LDKChannelFeatures val_conv;
23864 val_conv.inner = (void*)(val & (~1));
23865 val_conv.is_owned = (val & 1) || (val == 0);
23866 val_conv = ChannelFeatures_clone(&val_conv);
23867 ChannelInfo_set_features(&this_ptr_conv, val_conv);
23870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23871 LDKChannelInfo this_ptr_conv;
23872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23873 this_ptr_conv.is_owned = false;
23874 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23875 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
23879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23880 LDKChannelInfo this_ptr_conv;
23881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23882 this_ptr_conv.is_owned = false;
23883 LDKPublicKey val_ref;
23884 CHECK((*env)->GetArrayLength(env, val) == 33);
23885 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23886 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
23889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23890 LDKChannelInfo this_ptr_conv;
23891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23892 this_ptr_conv.is_owned = false;
23893 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
23894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23896 uint64_t ret_ref = (uint64_t)ret_var.inner;
23897 if (ret_var.is_owned) {
23903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23904 LDKChannelInfo this_ptr_conv;
23905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23906 this_ptr_conv.is_owned = false;
23907 LDKDirectionalChannelInfo val_conv;
23908 val_conv.inner = (void*)(val & (~1));
23909 val_conv.is_owned = (val & 1) || (val == 0);
23910 val_conv = DirectionalChannelInfo_clone(&val_conv);
23911 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
23914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23915 LDKChannelInfo this_ptr_conv;
23916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23917 this_ptr_conv.is_owned = false;
23918 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23919 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
23923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23924 LDKChannelInfo this_ptr_conv;
23925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23926 this_ptr_conv.is_owned = false;
23927 LDKPublicKey val_ref;
23928 CHECK((*env)->GetArrayLength(env, val) == 33);
23929 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23930 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
23933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23934 LDKChannelInfo this_ptr_conv;
23935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23936 this_ptr_conv.is_owned = false;
23937 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&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_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23948 LDKChannelInfo this_ptr_conv;
23949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23950 this_ptr_conv.is_owned = false;
23951 LDKDirectionalChannelInfo val_conv;
23952 val_conv.inner = (void*)(val & (~1));
23953 val_conv.is_owned = (val & 1) || (val == 0);
23954 val_conv = DirectionalChannelInfo_clone(&val_conv);
23955 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
23958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
23959 LDKChannelInfo this_ptr_conv;
23960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23961 this_ptr_conv.is_owned = false;
23962 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23963 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
23964 uint64_t ret_ref = (uint64_t)ret_copy;
23968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23969 LDKChannelInfo this_ptr_conv;
23970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23971 this_ptr_conv.is_owned = false;
23972 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23973 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
23976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23977 LDKChannelInfo this_ptr_conv;
23978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23979 this_ptr_conv.is_owned = false;
23980 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
23981 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23982 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23983 uint64_t ret_ref = (uint64_t)ret_var.inner;
23984 if (ret_var.is_owned) {
23990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23991 LDKChannelInfo this_ptr_conv;
23992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23993 this_ptr_conv.is_owned = false;
23994 LDKChannelAnnouncement val_conv;
23995 val_conv.inner = (void*)(val & (~1));
23996 val_conv.is_owned = (val & 1) || (val == 0);
23997 val_conv = ChannelAnnouncement_clone(&val_conv);
23998 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
24001 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) {
24002 LDKChannelFeatures features_arg_conv;
24003 features_arg_conv.inner = (void*)(features_arg & (~1));
24004 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24005 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
24006 LDKPublicKey node_one_arg_ref;
24007 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
24008 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
24009 LDKDirectionalChannelInfo one_to_two_arg_conv;
24010 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
24011 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
24012 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
24013 LDKPublicKey node_two_arg_ref;
24014 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
24015 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
24016 LDKDirectionalChannelInfo two_to_one_arg_conv;
24017 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
24018 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
24019 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
24020 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
24021 LDKChannelAnnouncement announcement_message_arg_conv;
24022 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24023 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24024 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
24025 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);
24026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24028 uint64_t ret_ref = (uint64_t)ret_var.inner;
24029 if (ret_var.is_owned) {
24035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24036 LDKChannelInfo orig_conv;
24037 orig_conv.inner = (void*)(orig & (~1));
24038 orig_conv.is_owned = false;
24039 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
24040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24042 uint64_t ret_ref = (uint64_t)ret_var.inner;
24043 if (ret_var.is_owned) {
24049 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24050 LDKChannelInfo obj_conv;
24051 obj_conv.inner = (void*)(obj & (~1));
24052 obj_conv.is_owned = false;
24053 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
24054 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24055 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24056 CVec_u8Z_free(ret_var);
24060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24061 LDKu8slice ser_ref;
24062 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24063 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24064 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24065 *ret_conv = ChannelInfo_read(ser_ref);
24066 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24067 return (uint64_t)ret_conv;
24070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24071 LDKRoutingFees this_obj_conv;
24072 this_obj_conv.inner = (void*)(this_obj & (~1));
24073 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24074 RoutingFees_free(this_obj_conv);
24077 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24078 LDKRoutingFees this_ptr_conv;
24079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24080 this_ptr_conv.is_owned = false;
24081 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
24085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24086 LDKRoutingFees this_ptr_conv;
24087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24088 this_ptr_conv.is_owned = false;
24089 RoutingFees_set_base_msat(&this_ptr_conv, val);
24092 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
24093 LDKRoutingFees this_ptr_conv;
24094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24095 this_ptr_conv.is_owned = false;
24096 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
24100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24101 LDKRoutingFees this_ptr_conv;
24102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24103 this_ptr_conv.is_owned = false;
24104 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
24107 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) {
24108 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
24109 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24110 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24111 uint64_t ret_ref = (uint64_t)ret_var.inner;
24112 if (ret_var.is_owned) {
24118 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24119 LDKRoutingFees a_conv;
24120 a_conv.inner = (void*)(a & (~1));
24121 a_conv.is_owned = false;
24122 LDKRoutingFees b_conv;
24123 b_conv.inner = (void*)(b & (~1));
24124 b_conv.is_owned = false;
24125 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
24129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24130 LDKRoutingFees orig_conv;
24131 orig_conv.inner = (void*)(orig & (~1));
24132 orig_conv.is_owned = false;
24133 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
24134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24136 uint64_t ret_ref = (uint64_t)ret_var.inner;
24137 if (ret_var.is_owned) {
24143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
24144 LDKRoutingFees obj_conv;
24145 obj_conv.inner = (void*)(obj & (~1));
24146 obj_conv.is_owned = false;
24147 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
24148 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24149 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24150 CVec_u8Z_free(ret_var);
24154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24155 LDKu8slice ser_ref;
24156 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24157 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24158 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24159 *ret_conv = RoutingFees_read(ser_ref);
24160 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24161 return (uint64_t)ret_conv;
24164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24165 LDKNodeAnnouncementInfo this_obj_conv;
24166 this_obj_conv.inner = (void*)(this_obj & (~1));
24167 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24168 NodeAnnouncementInfo_free(this_obj_conv);
24171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24172 LDKNodeAnnouncementInfo this_ptr_conv;
24173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24174 this_ptr_conv.is_owned = false;
24175 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
24176 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24177 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24178 uint64_t ret_ref = (uint64_t)ret_var.inner;
24179 if (ret_var.is_owned) {
24185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24186 LDKNodeAnnouncementInfo this_ptr_conv;
24187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24188 this_ptr_conv.is_owned = false;
24189 LDKNodeFeatures val_conv;
24190 val_conv.inner = (void*)(val & (~1));
24191 val_conv.is_owned = (val & 1) || (val == 0);
24192 val_conv = NodeFeatures_clone(&val_conv);
24193 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
24196 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
24197 LDKNodeAnnouncementInfo this_ptr_conv;
24198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24199 this_ptr_conv.is_owned = false;
24200 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
24204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24205 LDKNodeAnnouncementInfo this_ptr_conv;
24206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24207 this_ptr_conv.is_owned = false;
24208 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
24211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
24212 LDKNodeAnnouncementInfo this_ptr_conv;
24213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24214 this_ptr_conv.is_owned = false;
24215 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
24216 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
24220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24221 LDKNodeAnnouncementInfo this_ptr_conv;
24222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24223 this_ptr_conv.is_owned = false;
24224 LDKThreeBytes val_ref;
24225 CHECK((*env)->GetArrayLength(env, val) == 3);
24226 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
24227 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
24230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
24231 LDKNodeAnnouncementInfo this_ptr_conv;
24232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24233 this_ptr_conv.is_owned = false;
24234 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24235 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
24239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24240 LDKNodeAnnouncementInfo this_ptr_conv;
24241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24242 this_ptr_conv.is_owned = false;
24243 LDKThirtyTwoBytes val_ref;
24244 CHECK((*env)->GetArrayLength(env, val) == 32);
24245 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24246 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
24249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24250 LDKNodeAnnouncementInfo this_ptr_conv;
24251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24252 this_ptr_conv.is_owned = false;
24253 LDKCVec_NetAddressZ val_constr;
24254 val_constr.datalen = (*env)->GetArrayLength(env, val);
24255 if (val_constr.datalen > 0)
24256 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24258 val_constr.data = NULL;
24259 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24260 for (size_t m = 0; m < val_constr.datalen; m++) {
24261 int64_t val_conv_12 = val_vals[m];
24262 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
24263 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
24264 val_constr.data[m] = val_conv_12_conv;
24266 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24267 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
24270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
24271 LDKNodeAnnouncementInfo this_ptr_conv;
24272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24273 this_ptr_conv.is_owned = false;
24274 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
24275 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24276 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24277 uint64_t ret_ref = (uint64_t)ret_var.inner;
24278 if (ret_var.is_owned) {
24284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24285 LDKNodeAnnouncementInfo this_ptr_conv;
24286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24287 this_ptr_conv.is_owned = false;
24288 LDKNodeAnnouncement val_conv;
24289 val_conv.inner = (void*)(val & (~1));
24290 val_conv.is_owned = (val & 1) || (val == 0);
24291 val_conv = NodeAnnouncement_clone(&val_conv);
24292 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
24295 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) {
24296 LDKNodeFeatures features_arg_conv;
24297 features_arg_conv.inner = (void*)(features_arg & (~1));
24298 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24299 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
24300 LDKThreeBytes rgb_arg_ref;
24301 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
24302 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
24303 LDKThirtyTwoBytes alias_arg_ref;
24304 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
24305 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
24306 LDKCVec_NetAddressZ addresses_arg_constr;
24307 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
24308 if (addresses_arg_constr.datalen > 0)
24309 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24311 addresses_arg_constr.data = NULL;
24312 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
24313 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
24314 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
24315 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
24316 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
24318 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
24319 LDKNodeAnnouncement announcement_message_arg_conv;
24320 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24321 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24322 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
24323 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
24324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24326 uint64_t ret_ref = (uint64_t)ret_var.inner;
24327 if (ret_var.is_owned) {
24333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24334 LDKNodeAnnouncementInfo orig_conv;
24335 orig_conv.inner = (void*)(orig & (~1));
24336 orig_conv.is_owned = false;
24337 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24340 uint64_t ret_ref = (uint64_t)ret_var.inner;
24341 if (ret_var.is_owned) {
24347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24348 LDKNodeAnnouncementInfo obj_conv;
24349 obj_conv.inner = (void*)(obj & (~1));
24350 obj_conv.is_owned = false;
24351 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24352 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24353 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24354 CVec_u8Z_free(ret_var);
24358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24359 LDKu8slice ser_ref;
24360 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24361 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24362 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24363 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24364 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24365 return (uint64_t)ret_conv;
24368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24369 LDKNodeInfo this_obj_conv;
24370 this_obj_conv.inner = (void*)(this_obj & (~1));
24371 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24372 NodeInfo_free(this_obj_conv);
24375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24376 LDKNodeInfo this_ptr_conv;
24377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24378 this_ptr_conv.is_owned = false;
24379 LDKCVec_u64Z val_constr;
24380 val_constr.datalen = (*env)->GetArrayLength(env, val);
24381 if (val_constr.datalen > 0)
24382 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24384 val_constr.data = NULL;
24385 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24386 for (size_t g = 0; g < val_constr.datalen; g++) {
24387 int64_t val_conv_6 = val_vals[g];
24388 val_constr.data[g] = val_conv_6;
24390 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24391 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
24395 LDKNodeInfo this_ptr_conv;
24396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24397 this_ptr_conv.is_owned = false;
24398 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24399 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24400 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24401 uint64_t ret_ref = (uint64_t)ret_var.inner;
24402 if (ret_var.is_owned) {
24408 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) {
24409 LDKNodeInfo this_ptr_conv;
24410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24411 this_ptr_conv.is_owned = false;
24412 LDKRoutingFees val_conv;
24413 val_conv.inner = (void*)(val & (~1));
24414 val_conv.is_owned = (val & 1) || (val == 0);
24415 val_conv = RoutingFees_clone(&val_conv);
24416 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
24420 LDKNodeInfo this_ptr_conv;
24421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24422 this_ptr_conv.is_owned = false;
24423 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24424 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24425 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24426 uint64_t ret_ref = (uint64_t)ret_var.inner;
24427 if (ret_var.is_owned) {
24433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24434 LDKNodeInfo this_ptr_conv;
24435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24436 this_ptr_conv.is_owned = false;
24437 LDKNodeAnnouncementInfo val_conv;
24438 val_conv.inner = (void*)(val & (~1));
24439 val_conv.is_owned = (val & 1) || (val == 0);
24440 val_conv = NodeAnnouncementInfo_clone(&val_conv);
24441 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
24444 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) {
24445 LDKCVec_u64Z channels_arg_constr;
24446 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
24447 if (channels_arg_constr.datalen > 0)
24448 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24450 channels_arg_constr.data = NULL;
24451 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
24452 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
24453 int64_t channels_arg_conv_6 = channels_arg_vals[g];
24454 channels_arg_constr.data[g] = channels_arg_conv_6;
24456 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
24457 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
24458 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
24459 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
24460 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
24461 LDKNodeAnnouncementInfo announcement_info_arg_conv;
24462 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
24463 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
24464 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
24465 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
24466 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24467 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24468 uint64_t ret_ref = (uint64_t)ret_var.inner;
24469 if (ret_var.is_owned) {
24475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24476 LDKNodeInfo orig_conv;
24477 orig_conv.inner = (void*)(orig & (~1));
24478 orig_conv.is_owned = false;
24479 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
24480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24482 uint64_t ret_ref = (uint64_t)ret_var.inner;
24483 if (ret_var.is_owned) {
24489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24490 LDKNodeInfo obj_conv;
24491 obj_conv.inner = (void*)(obj & (~1));
24492 obj_conv.is_owned = false;
24493 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
24494 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24495 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24496 CVec_u8Z_free(ret_var);
24500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24501 LDKu8slice ser_ref;
24502 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24503 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24504 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24505 *ret_conv = NodeInfo_read(ser_ref);
24506 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24507 return (uint64_t)ret_conv;
24510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
24511 LDKNetworkGraph obj_conv;
24512 obj_conv.inner = (void*)(obj & (~1));
24513 obj_conv.is_owned = false;
24514 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
24515 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24516 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24517 CVec_u8Z_free(ret_var);
24521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24522 LDKu8slice ser_ref;
24523 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24524 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24525 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24526 *ret_conv = NetworkGraph_read(ser_ref);
24527 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24528 return (uint64_t)ret_conv;
24531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
24532 LDKThirtyTwoBytes genesis_hash_ref;
24533 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
24534 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
24535 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
24536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24538 uint64_t ret_ref = (uint64_t)ret_var.inner;
24539 if (ret_var.is_owned) {
24545 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) {
24546 LDKNetworkGraph this_arg_conv;
24547 this_arg_conv.inner = (void*)(this_arg & (~1));
24548 this_arg_conv.is_owned = false;
24549 LDKNodeAnnouncement msg_conv;
24550 msg_conv.inner = (void*)(msg & (~1));
24551 msg_conv.is_owned = false;
24552 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24553 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
24554 return (uint64_t)ret_conv;
24557 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) {
24558 LDKNetworkGraph this_arg_conv;
24559 this_arg_conv.inner = (void*)(this_arg & (~1));
24560 this_arg_conv.is_owned = false;
24561 LDKUnsignedNodeAnnouncement msg_conv;
24562 msg_conv.inner = (void*)(msg & (~1));
24563 msg_conv.is_owned = false;
24564 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24565 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
24566 return (uint64_t)ret_conv;
24569 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) {
24570 LDKNetworkGraph this_arg_conv;
24571 this_arg_conv.inner = (void*)(this_arg & (~1));
24572 this_arg_conv.is_owned = false;
24573 LDKChannelAnnouncement msg_conv;
24574 msg_conv.inner = (void*)(msg & (~1));
24575 msg_conv.is_owned = false;
24576 LDKAccess *chain_access_conv_ptr = NULL;
24577 if (chain_access != 0) {
24578 LDKAccess chain_access_conv;
24579 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24580 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24581 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24582 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24584 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24585 *chain_access_conv_ptr = chain_access_conv;
24587 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24588 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24589 return (uint64_t)ret_conv;
24592 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) {
24593 LDKNetworkGraph this_arg_conv;
24594 this_arg_conv.inner = (void*)(this_arg & (~1));
24595 this_arg_conv.is_owned = false;
24596 LDKUnsignedChannelAnnouncement msg_conv;
24597 msg_conv.inner = (void*)(msg & (~1));
24598 msg_conv.is_owned = false;
24599 LDKAccess *chain_access_conv_ptr = NULL;
24600 if (chain_access != 0) {
24601 LDKAccess chain_access_conv;
24602 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24603 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24604 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24605 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24607 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24608 *chain_access_conv_ptr = chain_access_conv;
24610 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24611 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24612 return (uint64_t)ret_conv;
24615 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) {
24616 LDKNetworkGraph this_arg_conv;
24617 this_arg_conv.inner = (void*)(this_arg & (~1));
24618 this_arg_conv.is_owned = false;
24619 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
24622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24623 LDKNetworkGraph this_arg_conv;
24624 this_arg_conv.inner = (void*)(this_arg & (~1));
24625 this_arg_conv.is_owned = false;
24626 LDKChannelUpdate msg_conv;
24627 msg_conv.inner = (void*)(msg & (~1));
24628 msg_conv.is_owned = false;
24629 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24630 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
24631 return (uint64_t)ret_conv;
24634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24635 LDKNetworkGraph this_arg_conv;
24636 this_arg_conv.inner = (void*)(this_arg & (~1));
24637 this_arg_conv.is_owned = false;
24638 LDKUnsignedChannelUpdate msg_conv;
24639 msg_conv.inner = (void*)(msg & (~1));
24640 msg_conv.is_owned = false;
24641 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24642 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
24643 return (uint64_t)ret_conv;
24646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24647 LDKFilesystemPersister this_obj_conv;
24648 this_obj_conv.inner = (void*)(this_obj & (~1));
24649 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24650 FilesystemPersister_free(this_obj_conv);
24653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
24654 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
24655 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
24656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24658 uint64_t ret_ref = (uint64_t)ret_var.inner;
24659 if (ret_var.is_owned) {
24665 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
24666 LDKFilesystemPersister this_arg_conv;
24667 this_arg_conv.inner = (void*)(this_arg & (~1));
24668 this_arg_conv.is_owned = false;
24669 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
24670 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
24675 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
24676 LDKChannelManager manager_conv;
24677 manager_conv.inner = (void*)(manager & (~1));
24678 manager_conv.is_owned = false;
24679 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24680 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
24681 return (uint64_t)ret_conv;
24684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
24685 LDKFilesystemPersister this_arg_conv;
24686 this_arg_conv.inner = (void*)(this_arg & (~1));
24687 this_arg_conv.is_owned = false;
24688 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
24689 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
24690 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24691 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
24693 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
24694 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
24695 return (uint64_t)ret_conv;
24698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
24699 LDKFilesystemPersister this_arg_conv;
24700 this_arg_conv.inner = (void*)(this_arg & (~1));
24701 this_arg_conv.is_owned = false;
24702 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
24703 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
24704 return (uint64_t)ret;
24707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24708 LDKBackgroundProcessor 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 BackgroundProcessor_free(this_obj_conv);
24714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24715 if ((this_ptr & 1) != 0) return;
24716 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
24717 FREE((void*)this_ptr);
24718 ChannelManagerPersister_free(this_ptr_conv);
24721 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) {
24722 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
24723 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
24724 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24725 LDKChannelManagerPersister_JCalls_clone(persister_conv.this_arg);
24727 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
24728 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
24729 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24730 LDKEventHandler_JCalls_clone(event_handler_conv.this_arg);
24732 LDKChainMonitor chain_monitor_conv;
24733 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
24734 chain_monitor_conv.is_owned = false;
24735 LDKChannelManager channel_manager_conv;
24736 channel_manager_conv.inner = (void*)(channel_manager & (~1));
24737 channel_manager_conv.is_owned = false;
24738 LDKPeerManager peer_manager_conv;
24739 peer_manager_conv.inner = (void*)(peer_manager & (~1));
24740 peer_manager_conv.is_owned = false;
24741 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24742 if (logger_conv.free == LDKLogger_JCalls_free) {
24743 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24744 LDKLogger_JCalls_clone(logger_conv.this_arg);
24746 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
24747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24749 uint64_t ret_ref = (uint64_t)ret_var.inner;
24750 if (ret_var.is_owned) {
24756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
24757 LDKBackgroundProcessor this_arg_conv;
24758 this_arg_conv.inner = (void*)(this_arg & (~1));
24759 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24760 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
24761 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24762 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
24763 return (uint64_t)ret_conv;
24766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
24770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24771 LDKInvoice this_obj_conv;
24772 this_obj_conv.inner = (void*)(this_obj & (~1));
24773 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24774 Invoice_free(this_obj_conv);
24777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24779 a_conv.inner = (void*)(a & (~1));
24780 a_conv.is_owned = false;
24782 b_conv.inner = (void*)(b & (~1));
24783 b_conv.is_owned = false;
24784 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
24788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24789 LDKInvoice orig_conv;
24790 orig_conv.inner = (void*)(orig & (~1));
24791 orig_conv.is_owned = false;
24792 LDKInvoice ret_var = Invoice_clone(&orig_conv);
24793 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24794 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24795 uint64_t ret_ref = (uint64_t)ret_var.inner;
24796 if (ret_var.is_owned) {
24802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24803 LDKSignedRawInvoice this_obj_conv;
24804 this_obj_conv.inner = (void*)(this_obj & (~1));
24805 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24806 SignedRawInvoice_free(this_obj_conv);
24809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24810 LDKSignedRawInvoice a_conv;
24811 a_conv.inner = (void*)(a & (~1));
24812 a_conv.is_owned = false;
24813 LDKSignedRawInvoice b_conv;
24814 b_conv.inner = (void*)(b & (~1));
24815 b_conv.is_owned = false;
24816 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
24820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24821 LDKSignedRawInvoice orig_conv;
24822 orig_conv.inner = (void*)(orig & (~1));
24823 orig_conv.is_owned = false;
24824 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
24825 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24826 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24827 uint64_t ret_ref = (uint64_t)ret_var.inner;
24828 if (ret_var.is_owned) {
24834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24835 LDKRawInvoice this_obj_conv;
24836 this_obj_conv.inner = (void*)(this_obj & (~1));
24837 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24838 RawInvoice_free(this_obj_conv);
24841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
24842 LDKRawInvoice this_ptr_conv;
24843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24844 this_ptr_conv.is_owned = false;
24845 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
24846 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24847 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24848 uint64_t ret_ref = (uint64_t)ret_var.inner;
24849 if (ret_var.is_owned) {
24855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24856 LDKRawInvoice this_ptr_conv;
24857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24858 this_ptr_conv.is_owned = false;
24859 LDKRawDataPart val_conv;
24860 val_conv.inner = (void*)(val & (~1));
24861 val_conv.is_owned = (val & 1) || (val == 0);
24862 val_conv = RawDataPart_clone(&val_conv);
24863 RawInvoice_set_data(&this_ptr_conv, val_conv);
24866 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24867 LDKRawInvoice a_conv;
24868 a_conv.inner = (void*)(a & (~1));
24869 a_conv.is_owned = false;
24870 LDKRawInvoice b_conv;
24871 b_conv.inner = (void*)(b & (~1));
24872 b_conv.is_owned = false;
24873 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
24877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24878 LDKRawInvoice orig_conv;
24879 orig_conv.inner = (void*)(orig & (~1));
24880 orig_conv.is_owned = false;
24881 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
24882 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24883 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24884 uint64_t ret_ref = (uint64_t)ret_var.inner;
24885 if (ret_var.is_owned) {
24891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24892 LDKRawDataPart this_obj_conv;
24893 this_obj_conv.inner = (void*)(this_obj & (~1));
24894 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24895 RawDataPart_free(this_obj_conv);
24898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
24899 LDKRawDataPart this_ptr_conv;
24900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24901 this_ptr_conv.is_owned = false;
24902 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
24903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24905 uint64_t ret_ref = (uint64_t)ret_var.inner;
24906 if (ret_var.is_owned) {
24912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24913 LDKRawDataPart this_ptr_conv;
24914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24915 this_ptr_conv.is_owned = false;
24916 LDKPositiveTimestamp val_conv;
24917 val_conv.inner = (void*)(val & (~1));
24918 val_conv.is_owned = (val & 1) || (val == 0);
24919 val_conv = PositiveTimestamp_clone(&val_conv);
24920 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
24923 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24924 LDKRawDataPart a_conv;
24925 a_conv.inner = (void*)(a & (~1));
24926 a_conv.is_owned = false;
24927 LDKRawDataPart b_conv;
24928 b_conv.inner = (void*)(b & (~1));
24929 b_conv.is_owned = false;
24930 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
24934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24935 LDKRawDataPart orig_conv;
24936 orig_conv.inner = (void*)(orig & (~1));
24937 orig_conv.is_owned = false;
24938 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
24939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24941 uint64_t ret_ref = (uint64_t)ret_var.inner;
24942 if (ret_var.is_owned) {
24948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24949 LDKPositiveTimestamp this_obj_conv;
24950 this_obj_conv.inner = (void*)(this_obj & (~1));
24951 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24952 PositiveTimestamp_free(this_obj_conv);
24955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24956 LDKPositiveTimestamp a_conv;
24957 a_conv.inner = (void*)(a & (~1));
24958 a_conv.is_owned = false;
24959 LDKPositiveTimestamp b_conv;
24960 b_conv.inner = (void*)(b & (~1));
24961 b_conv.is_owned = false;
24962 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
24966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24967 LDKPositiveTimestamp orig_conv;
24968 orig_conv.inner = (void*)(orig & (~1));
24969 orig_conv.is_owned = false;
24970 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
24971 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24972 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24973 uint64_t ret_ref = (uint64_t)ret_var.inner;
24974 if (ret_var.is_owned) {
24980 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24981 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
24982 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
24986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24987 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
24988 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
24989 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
24993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
24994 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
24995 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
24999 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25000 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
25001 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
25005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25006 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
25007 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
25008 jboolean ret_val = Currency_eq(a_conv, b_conv);
25012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25013 LDKSha256 this_obj_conv;
25014 this_obj_conv.inner = (void*)(this_obj & (~1));
25015 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25016 Sha256_free(this_obj_conv);
25019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25021 a_conv.inner = (void*)(a & (~1));
25022 a_conv.is_owned = false;
25024 b_conv.inner = (void*)(b & (~1));
25025 b_conv.is_owned = false;
25026 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
25030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25031 LDKSha256 orig_conv;
25032 orig_conv.inner = (void*)(orig & (~1));
25033 orig_conv.is_owned = false;
25034 LDKSha256 ret_var = Sha256_clone(&orig_conv);
25035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25036 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25037 uint64_t ret_ref = (uint64_t)ret_var.inner;
25038 if (ret_var.is_owned) {
25044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25045 LDKDescription this_obj_conv;
25046 this_obj_conv.inner = (void*)(this_obj & (~1));
25047 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25048 Description_free(this_obj_conv);
25051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25052 LDKDescription a_conv;
25053 a_conv.inner = (void*)(a & (~1));
25054 a_conv.is_owned = false;
25055 LDKDescription b_conv;
25056 b_conv.inner = (void*)(b & (~1));
25057 b_conv.is_owned = false;
25058 jboolean ret_val = Description_eq(&a_conv, &b_conv);
25062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25063 LDKDescription orig_conv;
25064 orig_conv.inner = (void*)(orig & (~1));
25065 orig_conv.is_owned = false;
25066 LDKDescription ret_var = Description_clone(&orig_conv);
25067 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25068 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25069 uint64_t ret_ref = (uint64_t)ret_var.inner;
25070 if (ret_var.is_owned) {
25076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25077 LDKPayeePubKey this_obj_conv;
25078 this_obj_conv.inner = (void*)(this_obj & (~1));
25079 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25080 PayeePubKey_free(this_obj_conv);
25083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25084 LDKPayeePubKey a_conv;
25085 a_conv.inner = (void*)(a & (~1));
25086 a_conv.is_owned = false;
25087 LDKPayeePubKey b_conv;
25088 b_conv.inner = (void*)(b & (~1));
25089 b_conv.is_owned = false;
25090 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
25094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25095 LDKPayeePubKey orig_conv;
25096 orig_conv.inner = (void*)(orig & (~1));
25097 orig_conv.is_owned = false;
25098 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
25099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25101 uint64_t ret_ref = (uint64_t)ret_var.inner;
25102 if (ret_var.is_owned) {
25108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25109 LDKExpiryTime this_obj_conv;
25110 this_obj_conv.inner = (void*)(this_obj & (~1));
25111 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25112 ExpiryTime_free(this_obj_conv);
25115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25116 LDKExpiryTime a_conv;
25117 a_conv.inner = (void*)(a & (~1));
25118 a_conv.is_owned = false;
25119 LDKExpiryTime b_conv;
25120 b_conv.inner = (void*)(b & (~1));
25121 b_conv.is_owned = false;
25122 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
25126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25127 LDKExpiryTime orig_conv;
25128 orig_conv.inner = (void*)(orig & (~1));
25129 orig_conv.is_owned = false;
25130 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
25131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25133 uint64_t ret_ref = (uint64_t)ret_var.inner;
25134 if (ret_var.is_owned) {
25140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25141 LDKMinFinalCltvExpiry this_obj_conv;
25142 this_obj_conv.inner = (void*)(this_obj & (~1));
25143 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25144 MinFinalCltvExpiry_free(this_obj_conv);
25147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25148 LDKMinFinalCltvExpiry a_conv;
25149 a_conv.inner = (void*)(a & (~1));
25150 a_conv.is_owned = false;
25151 LDKMinFinalCltvExpiry b_conv;
25152 b_conv.inner = (void*)(b & (~1));
25153 b_conv.is_owned = false;
25154 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
25158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25159 LDKMinFinalCltvExpiry orig_conv;
25160 orig_conv.inner = (void*)(orig & (~1));
25161 orig_conv.is_owned = false;
25162 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
25163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25165 uint64_t ret_ref = (uint64_t)ret_var.inner;
25166 if (ret_var.is_owned) {
25172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25173 if ((this_ptr & 1) != 0) return;
25174 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
25175 FREE((void*)this_ptr);
25176 Fallback_free(this_ptr_conv);
25179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25180 LDKFallback* orig_conv = (LDKFallback*)orig;
25181 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25182 *ret_copy = Fallback_clone(orig_conv);
25183 uint64_t ret_ref = (uint64_t)ret_copy;
25187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25188 LDKFallback* a_conv = (LDKFallback*)a;
25189 LDKFallback* b_conv = (LDKFallback*)b;
25190 jboolean ret_val = Fallback_eq(a_conv, b_conv);
25194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25195 LDKInvoiceSignature this_obj_conv;
25196 this_obj_conv.inner = (void*)(this_obj & (~1));
25197 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25198 InvoiceSignature_free(this_obj_conv);
25201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25202 LDKInvoiceSignature a_conv;
25203 a_conv.inner = (void*)(a & (~1));
25204 a_conv.is_owned = false;
25205 LDKInvoiceSignature b_conv;
25206 b_conv.inner = (void*)(b & (~1));
25207 b_conv.is_owned = false;
25208 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
25212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25213 LDKInvoiceSignature orig_conv;
25214 orig_conv.inner = (void*)(orig & (~1));
25215 orig_conv.is_owned = false;
25216 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
25217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25219 uint64_t ret_ref = (uint64_t)ret_var.inner;
25220 if (ret_var.is_owned) {
25226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25227 LDKPrivateRoute this_obj_conv;
25228 this_obj_conv.inner = (void*)(this_obj & (~1));
25229 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25230 PrivateRoute_free(this_obj_conv);
25233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25234 LDKPrivateRoute a_conv;
25235 a_conv.inner = (void*)(a & (~1));
25236 a_conv.is_owned = false;
25237 LDKPrivateRoute b_conv;
25238 b_conv.inner = (void*)(b & (~1));
25239 b_conv.is_owned = false;
25240 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
25244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25245 LDKPrivateRoute orig_conv;
25246 orig_conv.inner = (void*)(orig & (~1));
25247 orig_conv.is_owned = false;
25248 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
25249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25251 uint64_t ret_ref = (uint64_t)ret_var.inner;
25252 if (ret_var.is_owned) {
25258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
25259 LDKSignedRawInvoice this_arg_conv;
25260 this_arg_conv.inner = (void*)(this_arg & (~1));
25261 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25262 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
25263 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
25264 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
25265 return (uint64_t)ret_ref;
25268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
25269 LDKSignedRawInvoice this_arg_conv;
25270 this_arg_conv.inner = (void*)(this_arg & (~1));
25271 this_arg_conv.is_owned = false;
25272 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
25273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25275 uint64_t ret_ref = (uint64_t)ret_var.inner;
25276 if (ret_var.is_owned) {
25282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25283 LDKSignedRawInvoice this_arg_conv;
25284 this_arg_conv.inner = (void*)(this_arg & (~1));
25285 this_arg_conv.is_owned = false;
25286 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25287 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
25291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25292 LDKSignedRawInvoice this_arg_conv;
25293 this_arg_conv.inner = (void*)(this_arg & (~1));
25294 this_arg_conv.is_owned = false;
25295 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
25296 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25297 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25298 uint64_t ret_ref = (uint64_t)ret_var.inner;
25299 if (ret_var.is_owned) {
25305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25306 LDKSignedRawInvoice this_arg_conv;
25307 this_arg_conv.inner = (void*)(this_arg & (~1));
25308 this_arg_conv.is_owned = false;
25309 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
25310 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
25311 return (uint64_t)ret_conv;
25314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25315 LDKSignedRawInvoice this_arg_conv;
25316 this_arg_conv.inner = (void*)(this_arg & (~1));
25317 this_arg_conv.is_owned = false;
25318 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
25322 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25323 LDKRawInvoice this_arg_conv;
25324 this_arg_conv.inner = (void*)(this_arg & (~1));
25325 this_arg_conv.is_owned = false;
25326 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25327 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
25331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25332 LDKRawInvoice this_arg_conv;
25333 this_arg_conv.inner = (void*)(this_arg & (~1));
25334 this_arg_conv.is_owned = false;
25335 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
25336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25338 uint64_t ret_ref = (uint64_t)ret_var.inner;
25339 if (ret_var.is_owned) {
25345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
25346 LDKRawInvoice this_arg_conv;
25347 this_arg_conv.inner = (void*)(this_arg & (~1));
25348 this_arg_conv.is_owned = false;
25349 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
25350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25352 uint64_t ret_ref = (uint64_t)ret_var.inner;
25353 if (ret_var.is_owned) {
25359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25360 LDKRawInvoice this_arg_conv;
25361 this_arg_conv.inner = (void*)(this_arg & (~1));
25362 this_arg_conv.is_owned = false;
25363 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
25364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25366 uint64_t ret_ref = (uint64_t)ret_var.inner;
25367 if (ret_var.is_owned) {
25373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25374 LDKRawInvoice this_arg_conv;
25375 this_arg_conv.inner = (void*)(this_arg & (~1));
25376 this_arg_conv.is_owned = false;
25377 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
25378 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25379 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25380 uint64_t ret_ref = (uint64_t)ret_var.inner;
25381 if (ret_var.is_owned) {
25387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25388 LDKRawInvoice this_arg_conv;
25389 this_arg_conv.inner = (void*)(this_arg & (~1));
25390 this_arg_conv.is_owned = false;
25391 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
25392 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25393 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25394 uint64_t ret_ref = (uint64_t)ret_var.inner;
25395 if (ret_var.is_owned) {
25401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25402 LDKRawInvoice this_arg_conv;
25403 this_arg_conv.inner = (void*)(this_arg & (~1));
25404 this_arg_conv.is_owned = false;
25405 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
25406 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25407 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25408 uint64_t ret_ref = (uint64_t)ret_var.inner;
25409 if (ret_var.is_owned) {
25415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25416 LDKRawInvoice this_arg_conv;
25417 this_arg_conv.inner = (void*)(this_arg & (~1));
25418 this_arg_conv.is_owned = false;
25419 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25420 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
25424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25425 LDKRawInvoice this_arg_conv;
25426 this_arg_conv.inner = (void*)(this_arg & (~1));
25427 this_arg_conv.is_owned = false;
25428 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
25429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25431 uint64_t ret_ref = (uint64_t)ret_var.inner;
25432 if (ret_var.is_owned) {
25438 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25439 LDKRawInvoice this_arg_conv;
25440 this_arg_conv.inner = (void*)(this_arg & (~1));
25441 this_arg_conv.is_owned = false;
25442 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
25443 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25444 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25445 for (size_t o = 0; o < ret_var.datalen; o++) {
25446 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25447 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25448 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25449 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25450 if (ret_conv_14_var.is_owned) {
25451 ret_conv_14_ref |= 1;
25453 ret_arr_ptr[o] = ret_conv_14_ref;
25455 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25456 FREE(ret_var.data);
25460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25461 LDKRawInvoice this_arg_conv;
25462 this_arg_conv.inner = (void*)(this_arg & (~1));
25463 this_arg_conv.is_owned = false;
25464 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25465 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
25466 uint64_t ret_ref = (uint64_t)ret_copy;
25470 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25471 LDKRawInvoice this_arg_conv;
25472 this_arg_conv.inner = (void*)(this_arg & (~1));
25473 this_arg_conv.is_owned = false;
25474 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
25478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
25479 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25480 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
25481 return (uint64_t)ret_conv;
25484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
25485 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25486 *ret_conv = PositiveTimestamp_from_system_time(time);
25487 return (uint64_t)ret_conv;
25490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25491 LDKPositiveTimestamp this_arg_conv;
25492 this_arg_conv.inner = (void*)(this_arg & (~1));
25493 this_arg_conv.is_owned = false;
25494 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
25498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25499 LDKPositiveTimestamp this_arg_conv;
25500 this_arg_conv.inner = (void*)(this_arg & (~1));
25501 this_arg_conv.is_owned = false;
25502 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
25506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
25507 LDKInvoice this_arg_conv;
25508 this_arg_conv.inner = (void*)(this_arg & (~1));
25509 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25510 this_arg_conv = Invoice_clone(&this_arg_conv);
25511 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
25512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25514 uint64_t ret_ref = (uint64_t)ret_var.inner;
25515 if (ret_var.is_owned) {
25521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25522 LDKInvoice this_arg_conv;
25523 this_arg_conv.inner = (void*)(this_arg & (~1));
25524 this_arg_conv.is_owned = false;
25525 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
25526 *ret_conv = Invoice_check_signature(&this_arg_conv);
25527 return (uint64_t)ret_conv;
25530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
25531 LDKSignedRawInvoice signed_invoice_conv;
25532 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
25533 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
25534 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
25535 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
25536 *ret_conv = Invoice_from_signed(signed_invoice_conv);
25537 return (uint64_t)ret_conv;
25540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25541 LDKInvoice this_arg_conv;
25542 this_arg_conv.inner = (void*)(this_arg & (~1));
25543 this_arg_conv.is_owned = false;
25544 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
25548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25549 LDKInvoice this_arg_conv;
25550 this_arg_conv.inner = (void*)(this_arg & (~1));
25551 this_arg_conv.is_owned = false;
25552 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25553 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
25557 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25558 LDKInvoice this_arg_conv;
25559 this_arg_conv.inner = (void*)(this_arg & (~1));
25560 this_arg_conv.is_owned = false;
25561 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25562 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
25566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25567 LDKInvoice this_arg_conv;
25568 this_arg_conv.inner = (void*)(this_arg & (~1));
25569 this_arg_conv.is_owned = false;
25570 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25571 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
25575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25576 LDKInvoice this_arg_conv;
25577 this_arg_conv.inner = (void*)(this_arg & (~1));
25578 this_arg_conv.is_owned = false;
25579 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
25580 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25581 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25582 uint64_t ret_ref = (uint64_t)ret_var.inner;
25583 if (ret_var.is_owned) {
25589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25590 LDKInvoice this_arg_conv;
25591 this_arg_conv.inner = (void*)(this_arg & (~1));
25592 this_arg_conv.is_owned = false;
25593 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25594 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
25598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25599 LDKInvoice this_arg_conv;
25600 this_arg_conv.inner = (void*)(this_arg & (~1));
25601 this_arg_conv.is_owned = false;
25602 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
25606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25607 LDKInvoice this_arg_conv;
25608 this_arg_conv.inner = (void*)(this_arg & (~1));
25609 this_arg_conv.is_owned = false;
25610 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
25614 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25615 LDKInvoice this_arg_conv;
25616 this_arg_conv.inner = (void*)(this_arg & (~1));
25617 this_arg_conv.is_owned = false;
25618 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
25619 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25620 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25621 for (size_t o = 0; o < ret_var.datalen; o++) {
25622 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25623 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25624 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25625 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25626 if (ret_conv_14_var.is_owned) {
25627 ret_conv_14_ref |= 1;
25629 ret_arr_ptr[o] = ret_conv_14_ref;
25631 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25632 FREE(ret_var.data);
25636 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
25637 LDKInvoice this_arg_conv;
25638 this_arg_conv.inner = (void*)(this_arg & (~1));
25639 this_arg_conv.is_owned = false;
25640 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
25641 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25642 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25643 for (size_t l = 0; l < ret_var.datalen; l++) {
25644 LDKRouteHint ret_conv_11_var = ret_var.data[l];
25645 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25646 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25647 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
25648 if (ret_conv_11_var.is_owned) {
25649 ret_conv_11_ref |= 1;
25651 ret_arr_ptr[l] = ret_conv_11_ref;
25653 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25654 FREE(ret_var.data);
25658 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25659 LDKInvoice this_arg_conv;
25660 this_arg_conv.inner = (void*)(this_arg & (~1));
25661 this_arg_conv.is_owned = false;
25662 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
25666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25667 LDKInvoice this_arg_conv;
25668 this_arg_conv.inner = (void*)(this_arg & (~1));
25669 this_arg_conv.is_owned = false;
25670 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25671 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
25672 uint64_t ret_ref = (uint64_t)ret_copy;
25676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
25677 LDKStr description_conv = java_to_owned_str(env, description);
25678 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
25679 *ret_conv = Description_new(description_conv);
25680 return (uint64_t)ret_conv;
25683 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25684 LDKDescription this_arg_conv;
25685 this_arg_conv.inner = (void*)(this_arg & (~1));
25686 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25687 this_arg_conv = Description_clone(&this_arg_conv);
25688 LDKStr ret_str = Description_into_inner(this_arg_conv);
25689 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
25694 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25695 *ret_conv = ExpiryTime_from_seconds(seconds);
25696 return (uint64_t)ret_conv;
25699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
25700 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25701 *ret_conv = ExpiryTime_from_duration(duration);
25702 return (uint64_t)ret_conv;
25705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
25706 LDKExpiryTime this_arg_conv;
25707 this_arg_conv.inner = (void*)(this_arg & (~1));
25708 this_arg_conv.is_owned = false;
25709 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
25713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
25714 LDKExpiryTime this_arg_conv;
25715 this_arg_conv.inner = (void*)(this_arg & (~1));
25716 this_arg_conv.is_owned = false;
25717 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
25721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
25722 LDKRouteHint hops_conv;
25723 hops_conv.inner = (void*)(hops & (~1));
25724 hops_conv.is_owned = (hops & 1) || (hops == 0);
25725 hops_conv = RouteHint_clone(&hops_conv);
25726 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
25727 *ret_conv = PrivateRoute_new(hops_conv);
25728 return (uint64_t)ret_conv;
25731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25732 LDKPrivateRoute this_arg_conv;
25733 this_arg_conv.inner = (void*)(this_arg & (~1));
25734 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25735 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
25736 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
25737 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25738 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25739 uint64_t ret_ref = (uint64_t)ret_var.inner;
25740 if (ret_var.is_owned) {
25746 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25747 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
25748 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
25752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25753 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
25754 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
25755 jboolean ret_val = CreationError_eq(a_conv, b_conv);
25759 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25760 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
25761 LDKStr ret_str = CreationError_to_str(o_conv);
25762 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25766 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25767 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
25768 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
25772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25773 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
25774 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
25775 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
25779 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25780 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
25781 LDKStr ret_str = SemanticError_to_str(o_conv);
25782 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25787 if ((this_ptr & 1) != 0) return;
25788 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
25789 FREE((void*)this_ptr);
25790 SignOrCreationError_free(this_ptr_conv);
25793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25794 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
25795 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
25796 *ret_copy = SignOrCreationError_clone(orig_conv);
25797 uint64_t ret_ref = (uint64_t)ret_copy;
25801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25802 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
25803 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
25804 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
25808 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25809 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
25810 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
25811 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25815 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) {
25816 LDKChannelManager channelmanager_conv;
25817 channelmanager_conv.inner = (void*)(channelmanager & (~1));
25818 channelmanager_conv.is_owned = false;
25819 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25820 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25821 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25822 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
25824 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
25825 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
25826 LDKStr description_conv = java_to_owned_str(env, description);
25827 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
25828 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
25829 return (uint64_t)ret_conv;
25832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25833 LDKStr s_conv = java_to_owned_str(env, s);
25834 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
25835 *ret_conv = SiPrefix_from_str(s_conv);
25836 return (uint64_t)ret_conv;
25839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25840 LDKStr s_conv = java_to_owned_str(env, s);
25841 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
25842 *ret_conv = Invoice_from_str(s_conv);
25843 return (uint64_t)ret_conv;
25846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25847 LDKStr s_conv = java_to_owned_str(env, s);
25848 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
25849 *ret_conv = SignedRawInvoice_from_str(s_conv);
25850 return (uint64_t)ret_conv;
25853 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25855 o_conv.inner = (void*)(o & (~1));
25856 o_conv.is_owned = false;
25857 LDKStr ret_str = Invoice_to_str(&o_conv);
25858 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25862 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25863 LDKSignedRawInvoice o_conv;
25864 o_conv.inner = (void*)(o & (~1));
25865 o_conv.is_owned = false;
25866 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
25867 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25871 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25872 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
25873 LDKStr ret_str = Currency_to_str(o_conv);
25874 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25878 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25879 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
25880 LDKStr ret_str = SiPrefix_to_str(o_conv);
25881 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25885 // __cxa_thread_atexit_impl is used to more effeciently cleanup per-thread local storage by rust libstd.
25886 // However, it is not available on glibc versions 2.17 or earlier, and rust libstd has a null-check and fallback in case it is missing.
25887 // Because it is weak-linked on the rust side, we should be able to simply define it explicitly here, forcing rust to use the fallback.
25888 void *__cxa_thread_atexit_impl = NULL;